• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data Predicates with Relationships and Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Core Data Predicates with Relationships and Objects (From: Adam Ernst <email@hidden>)

  • Prev by Date: Re: Strange behaviour of scanFloat
  • Next by Date: Re: NSTask and unicode arguments
  • Previous by thread: Core Data Predicates with Relationships and Objects
  • Next by thread: NSTask and unicode arguments
  • Index(es):
    • Date
    • Thread