• 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: wrapping my head around NSPredicate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wrapping my head around NSPredicate


  • Subject: Re: wrapping my head around NSPredicate
  • From: Charilaos Skiadas <email@hidden>
  • Date: Fri, 29 Jul 2005 14:27:03 -0500

So, you have a particular instance of classA, let's call it objA, and you want to find the instances of classB whose NamePK matches objA. Then I think this code I linked in the previous message should do it:

-(NSPredicate *)predicate
{
     NSPredicate *thePredicate = [NSPredicate
predicateWithFormat:@"NamePK == %@" argumentArray:[NSArray
arrayWithObject:instanceA]];
     return thePredicate;
}

On Jul 29, 2005, at 11:17 AM, Zameer Andani wrote:

Thanks Charilaos, and list...

I am trying to match NamePK to a particular instance of classA. i realize the method is not complete as I still need to return the NSPredicate*

What I'm trying to avoid is having to write the following (which is what i have right now), as it is extremely coupled with the layout of ClassA:

id value1 = [NamePK valueForKey:@"FirstName"];
id value2 = [NamePK valueForKey:@"LastName"];

[predicateFormat appendFormat: @"NamePK.FirstName == %@ And NamePK.LastName == %@", value1, value2];

Haris


_______________________________________________ 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: 
 >RE: wrapping my head around NSPredicate (From: "Zameer Andani" <email@hidden>)

  • Prev by Date: Re: NSLayoutManager Background Layout Crash
  • Next by Date: NSWorkspace
  • Previous by thread: RE: wrapping my head around NSPredicate
  • Next by thread: Re: wrapping my head around NSPredicate
  • Index(es):
    • Date
    • Thread