Question

I can't solve this problem... I'm having some problems with fetched properties (not with fetched requests).

How can I created a fetched property to get the entity with a minimum field? If you see these captures, you will see it: enter image description here enter image description here

What I have to write in fetched property called minItemTimestamp? I tried several options but don't work. "@min.items.timestamp" "items.@min.timestamp" @min seems it is an aggregate and not sure that is what I'm looking for.

I tried this reply, but no luck: Fetched Property in XCode Data Model Editor for minimum value

So, can I create a fetched property to get from all items that belong to current category, the one with minimum timestamp?

Thanks a lot, I appreciate your help a lot.

Was it helpful?

Solution

You do not need a fetched property.

use the following lines of code:

id minTimestamp=[myCategory.items valueForKeyPath:@"@min.timestamp"];
id maxTimestamp=[myCategory.items valueForKeyPath:@"@max.timestamp"];

see using a @min in predicate

OTHER TIPS

The NSFetchedResultsController will accept an array of NSSortDescriptors via a property and will sort the data for you accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top