• 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: More newbie questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More newbie questions


  • Subject: Re: More newbie questions
  • From: Sacha Michel Mallais <email@hidden>
  • Date: Tue, 15 Nov 2005 17:01:31 -0800

On Nov 15, 2005, at 3:48 PM, Randy Becker wrote:

On Nov 15, 2005, at 6:21 PM, Sacha Michel Mallais wrote:

On Nov 15, 2005, at 2:46 PM, Randy Becker wrote:

Right now I've got:
String format = "title caseInsensitiveLike %s";
NSArray args = new NSArray(searchQuery);
return EOUtilities.objectsWithQualifierFormat( session ().defaultEditingContext(), "Item", format, args);


but I'd like to do something like
String format = "(title caseInsensitiveLike %s) OR (title caseInsensitiveLike %s)";

That exact format string will work. The only difference is you'll need to include a second argument for the second %s.

D'oh! :)

by the way, there must be a better way of doing this than the following:
NSMutableArray arguments = new NSMutableArray();
arguments.addObject(searchQueryWithWildcard);
arguments.addObject(searchQueryWithWildcard);
NSArray args = new NSArray(arguments);

Well, you never need the last line, since NSMutableArray is a subclass of NSArray. You can do the first three lines in one line:
NSArray arguments = new NSArray(new Object[] {searchQueryWithWildcard, searchQueryWithWildcard});
OR
NSMutableArray arguments = new NSMutableArray(new Object[] {searchQueryWithWildcard, searchQueryWithWildcard});


I'm not sure if that's better or worse than three lines...


Secondly, how can I display data from an object related to one that is displayed in a WORepetition. Right now, I'm only able to access the attributes of a particular object I'm outputting, and the information I'd like to display is located in a related object.

Through the magic of Key Value Coding. If you have two objects a and b, where a relates to b, and where both have a "name" attribute, then all the following will work:


key path      gives
----------------------------------------
a             the object a
a.name        a's name
a.name.length a's name's length
a.b           the b that is related to a
a.b.name      the name of the b that is related to a

Actually, the two objects I'm dealing with in particular do not have the same attributes - I want to find the address of a person who owns an item, but an item can be owned and posessed by different people, thusly, I'm trying to do something like item.owner.address - but item also is related to a person by the item.possessor attribute...

The fact that they have the same attributes is irrelevant, sorry if I gave you that impression from my harebrained example.


So, if you have an "item", then
item.owner.address          key path to owner's address
item.possessor.address      key path to possessor's address
item.possessor.myAttribute  key path to possessor's myAttribute
item.owner.yourAttribute    key path to owner's yourAttribute

HTH,


sacha


-- Sacha Michel Mallais 400 lb. chimp Global Village Consulting Inc. http://www.global-village.net/ PGP Key ID: 7D757B65 AIM: smallais Choke on that, causality! -- the Professor, "Futurama"



Attachment: PGP.sig
Description: This is a digitally signed message part

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >More newbie questions (From: Randy Becker <email@hidden>)
 >Re: More newbie questions (From: Sacha Michel Mallais <email@hidden>)
 >Re: More newbie questions (From: Randy Becker <email@hidden>)

  • Prev by Date: Re: More newbie questions
  • Next by Date: Re: Sun Application server JDBC
  • Previous by thread: Re: More newbie questions
  • Next by thread: Re: More newbie questions
  • Index(es):
    • Date
    • Thread