Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetched Property in XCode Data Model Editor for minimum value

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

like image 790
wal Avatar asked Apr 19 '10 01:04

wal


People also ask

What is fetched property in Coredata?

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.

What is entity in Coredata?

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.

What is scalar Type Core Data?

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.

What is core data in IOS?

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.


1 Answers

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"
like image 119
Donald Avatar answered Oct 11 '22 04:10

Donald