Deleting column values

Tags ( )

If I complete delete all the content of a column, does the column value revert to nil or is it a NSString of length 0?

it depends. if you delete

it depends. if you delete the column content using the GUI that I think (if it's a string column) the value will be a string of length 0. But if you delete content from code (such as set the value to nil) then the value should be also saved as nil.

So would checks for an empty

So would checks for an empty column value look like this:

NSString *recurString = [entryData valueForKey:MGrecurKey];
if (!recurString || [recurString length] == 0) {
...
}

Thanks
Jeff

Yes I think that should do

Yes I think that should do the trick.

Just for completeness sake

Just for completeness sake (and so I don't miss any checks):

How are the other data types handled?
esp. numbers and dates? Erasing a column value completely will make the values 'nil' ir are there some sort of "0 length" values for dates and numbers?

Thanks

I'm not sure :( All the

I'm not sure :( All the different formatters and such it's hard to figure out what they will do sometimes. But my guess is that they might be using '0' to represent empty sometimes, so you might also want to check for that with dates and numbers. Probably best to actually check this though.

Well, after testing, I can

Well, after testing, I can confirm that, at least for Mori, erasing a date field will return the value to nil. I tested with two opposing predicates (one for nil and one for !nil) and also output the entryData description.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.