Re: Core Data Predicates with Relationships and Objects
Re: Core Data Predicates with Relationships and Objects
- Subject: Re: Core Data Predicates with Relationships and Objects
- From: mmalcolm crawford <email@hidden>
- Date: Sat, 5 Nov 2005 17:51:34 -0800
On Nov 5, 2005, at 4:52 PM, Adam Ernst wrote:
[NSPredicate predicateWithFormat:@"(customer==%@)", myCustomer];
("customer" is the name of the relationship that connects the order
to its parent customer. myCustomer is a NSManagedObject ptr, as
shown above.)
But that doesn't seem to work either. It fails to match any rows at
all.
It's not clear why this would return no rows. Is the inverse
relationship set up correctly in the model?
To *fetch* the most recent order for a given customer, you could
create a fetch request:
With entity: Order;
Predicate: [... predicateWithFormat:@"(customer==%@)", myCustomer];
Sort descriptor: descending by 'date';
Fetch limit: 1.
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden