• 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
building a predicate for empty optional to-many relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

building a predicate for empty optional to-many relationship


  • Subject: building a predicate for empty optional to-many relationship
  • From: Ken Victor <email@hidden>
  • Date: Tue, 5 Sep 2006 17:32:56 -0700

(the below is a simplified synopsis and typed into mail)

given a person entity that contains an optional to-many relationship, creditCards, and given that one of the properties of a CreditCard entity is its name, i can successfully set the filter predicate of an NSArrayController to select people who have a credit card with a specific name (eg):
NSPredicate* pred = [NSPredicate predicateWithFormat: @"ANY creditCards.name == %@", cardName];
[arrayController setFilterPredicate: pred];


this works fine and will only display (in the controlled NSTableView) those people who have the specified card name.

i would also like to be able to build a predicate to select all people who don't have any credit cards, or all people who have any credit cards. ie, i'd like to be able to build a predicate that will select empty or non-empty relationships.

i've searched the archives unsuccessfully and read the documentation and the predicates programming guide (several times) and still can't figure this out.

can someone point me to some more documentation or provide a sample of such predicates?

thanx,
ken
_______________________________________________
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


  • Prev by Date: Re: Programatically detect if any autorelease pool exists?
  • Next by Date: Re: Programatically detect if any autorelease pool exists?
  • Previous by thread: Re: Re: Unconventional memory leak problem
  • Next by thread: Re: Shift-clicking NSButtonCells?
  • Index(es):
    • Date
    • Thread