2010-04-19 34 views
11

如何在XCode的數據模型編輯器中添加Fetched屬性以獲取一個屬性的最小值?在XCode數據模型編輯器中獲取最小值的屬性

我的模型:

Model http://www.freeimagehosting.net/uploads/b48853070e.png

Item (name, note, storedItem) 
StoredItem (price, item) 
Item 1 ---> N StoredITem (1->N Relationship) 

我想要的項目有一個名爲minPrice已取得的財產,其價值是在storedItems設置好的價格的最低值。

例子:

Item1 (banana, storedItem1 ... storedItem4, 10) 
StoredItem1 (10,item1) 
StoredItem2 (15,item1) 
StoredItem3 (30,item1) 
StoredItem4 (54,item1) 

我把什麼目標? StoredItem?

Fetched Property in Data Model Editor http://www.freeimagehosting.net/uploads/2a68de007d.png

而且我該怎麼放?表達

Expression in Data Model Editor http://www.freeimagehosting.net/uploads/766ab9af6f.png

回答

2

目標是你想回來的實體類型。

聽起來你想要一個StoredItem,因爲它有一個價格。

我想你想要的是在項目已取得的財產被稱爲minPrice,這個表達式:

"@min.storedItems.price" 
相關問題