How do I add a Fetched Property in XCode's Data Model Editor for minimum value of one attribute??
My model:
Model http://www.freeimagehosting.net/uploads/b48853070e.png
Item (name, note, storedItem)
StoredItem (price, item)
Item 1 ---> N StoredITem (1->N Relationship)
I want that Item has a fetched property named minPrice and its value is the minimum value setted for price in the storedItems.
Example:
Item1 (banana, storedItem1 ... storedItem4, 10)
StoredItem1 (10,item1)
StoredItem2 (15,item1)
StoredItem3 (30,item1)
StoredItem4 (54,item1)
What do I put in Destination?? StoredItem?
Fetched Property in Data Model Editor http://www.freeimagehosting.net/uploads/2a68de007d.png
And what do I put in Expression??
Expression in Data Model Editor http://www.freeimagehosting.net/uploads/766ab9af6f.png
Fetched Properties in Core Data are properties that return an array value from a predicate. A fetched property predicate is a Core Data query that evaluates to an array of results.
An entity description describes an entity (which you can think of as a table in a database) in terms of its name, the name of the class used to represent the entity in your application, and what properties (attributes and relationships) it has.
Scalar Types Core Data has support for many common data types like integers, floats, booleans, and so on. However, by default, the data model editor generates these attributes as NSNumber properties in the managed object subclasses.
Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence.
The destination is the type of entity you want back.
It sounds like you want a StoredItem back, since that has a price on it.
What I think you want is a fetched property on Item called minPrice, with this expression:
"@min.storedItems.price"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With