Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Core Data - Newbie] Predicate Help




On Jul 30, 2005, at 8:52 PM, Charles Haron wrote:

Hello All,

I need to create a predicate that does the equivalent of the following:

SELECT SUM(itemPrice) FROM InvItems
WHERE inStore = FALSE;

Sorry, not used to this notation, do I understand correctly that what you want to obtain is the sum of all the values of itemPrice, over all invItems for which inStore is false?
Then I would do this in two steps:
1) Create a fetch request that returns an array of all invItems where inStore is false (That's where the predicate comes in, and it would really be a simple predicate.
2) Ask the array for the value of the keyPath "@sum.itemPrice".


****

InvItems is the entity
itemPrice & inStore are attributes.

Haris


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >[Core Data - Newbie] Predicate Help (From: Charles Haron <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.