• 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
Predicate help needed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Predicate help needed


  • Subject: Predicate help needed
  • From: Brad Bumgarner <email@hidden>
  • Date: Fri, 14 Jul 2006 14:17:57 -0600

Overview of project:
I am working on an app. that will allow for output to a printer (for faxing) or email message a proof confirmation for a client requesting work from the company I work for. Information input is the contact person's name, their company name, phone, fax, email, as well as the info. required for the requested job.


I would like to be able to enter the contact name in NSTokenField and query the Address Book as the entry is being made (al a Mail.app). I would like the organization name and phone, fax and email fields to display the information for the current token.


Current status (I'm still learning Obj-C):
I have an NSTextfield that I currently enter the text for the contact name. As the text is entered, the text is broken into component parts, into an NSArray, using a space as the separator. The Address Book is then queried for entries matching first name and last name. (I want to be able to enter either name first so each component is queried for both first and last names). These results are stored in an NSMutableSet, thus eliminating duplicates. The results are currently displayed in the run log (since I am still in the early building/testing phase).


Now I need to filter this set to remove objects that don't contain both (first name AND last name) OR (last name AND first name). It seems that I should be using a predicate here but I don't understand how to create and use them. I have read the documentation but quickly get lost.

Here are the "players" involved in my project that I believe I need to do the filtering:

NSArray *searchComponents;
This holds the string components (i.e.: "Brad Bumg" --> (@"Brad", @"Bumg")) the components could be in first name first order OR last name first order.



NSMutableSet *searchElements; // ABPerson objects matching at least one of the searchComponents entries



Would someone help me with the filtering process?

Thanks,
Brad Bumgarner, CTA

_______________________________________________
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


  • Follow-Ups:
    • Re: Predicate help needed
      • From: Adam Knight <email@hidden>
  • Prev by Date: Making Text Bigger and Smaller
  • Next by Date: Re: Getting added object with KVO
  • Previous by thread: Re: Making Text Bigger and Smaller
  • Next by thread: Re: Predicate help needed
  • Index(es):
    • Date
    • Thread