【问题标题】:Fetched Property in XCode Data Model Editor for minimum value在 XCode 数据模型编辑器中获取最小值的属性
【发布时间】:2011-02-09 12:32:45
【问题描述】:

如何在 XCode 的数据模型编辑器中添加 Fetched Property 以获得一个属性的最小值??

我的模特:

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

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

我希望 Item 有一个名为 minPrice 的提取属性,它的值是在 storedItems 中为 price 设置的最小值。

例子:

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

我在 Destination 中放了什么?存储项?

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

【问题讨论】:

    标签: cocoa xcode core-data minimum fetched-property


    【解决方案1】:

    目的地是您想要返回的实体类型。

    听起来你想要一个 StoredItem 回来,因为它是有代价的。

    我认为你想要的是一个名为 minPrice 的 Item 上的获取属性,使用以下表达式:

    "@min.storedItems.price"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-19
      • 2011-04-01
      • 2012-01-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多