• 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: EOOrQualifier generated from an array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOOrQualifier generated from an array


  • Subject: Re: EOOrQualifier generated from an array
  • From: Clark Mueller <email@hidden>
  • Date: Mon, 25 Dec 2006 23:03:59 -0700

Thanks Pierre, this does exactly what I need! Ken's was the method I had put together initially, but I still think this seems like such an intuitive behavior that EOF should really do of its own accord. Oh well! Looks like you have a lot of other cool tidbits on your web site there, I'll be checking those out.

Thank you both,
Clark

On 25 Dec 06, at 9:51 AM, Pierre Bernard wrote:

You may also want to use the InSetQualifier available from my web site: http://www.bernard-web.com/pierre/code.html

This will give you: where ... LOCATION in ($1, $2,...)

Pierre

On 25 Dec 2006, at 16:24, Ken Anderson wrote:

Clark,

You should look at all the qualifier classes. To do what you're asking, you would do something like this (NOT guaranteed to compile):

NSMutableArray orQualifiers = new NSMutableArray();
Enumeration locationEnum = locations.objectEnumerator();
while (locationEnum.hasMoreElements()) {
Location location = (Location) locationEnum.nextElement();
EOKeyValueQualifier qual = new EOKeyValueQualifier ("LOCATIONKEYPATH", EOQualifier.QualifierOperatorEqual, location);
}
EOOrQualifier orQualifier = new EOOrQualifier(orQualifiers);
EOKeyValueQualifier serialQual = new EOKeyValueQualifier ("serialNo", EOQualifier.QualifierOperatorEqual, "SERIALNO");
EOAndQualifier finalQualifier = new EOAndQualifier(new NSArray(new Object[] {serialQual, orQualifier}));


Again, this is from my memory, and I haven't tried to compile it, but hopefully you get the idea. Just create the fetch spec with finalQualifier.

Ken

On Dec 25, 2006, at 2:25 AM, Clark Mueller wrote:

Hello all,

I have a question about fetch specs, and use of arrays as an argument (or not). To me, it seems like intuitive behavior that passing an array as an argument to a fetch spec should generate an "or" qualifier string based on the elements of that array.

Suppose, for example, that I have an entity Inventory and Location. I have a fetch specification for Inventory that looks like "serialNo = $serialNo and location = $location". I would like to be able to pass an array of Locations to this fetch specification, such that a query is created looking like:

select ... from inventory where serialNo = $serialNo and (location=location1 or location=location2 or location=location3)

I'm pretty sure I've seen mention of this behavior before, but I don't quite see how to implement it. Is that something I can use joins for, or is there another way to do it other than manually building the qualifier?

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


This email sent to email@hidden

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


This email sent to email@hidden

- - - Houdah Software s. à r. l. http://www.houdah.com - Quality Mac OS X software - Premium WebObjects consulting






_______________________________________________ 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: 
 >EOOrQualifier generated from an array (From: Clark Mueller <email@hidden>)
 >Re: EOOrQualifier generated from an array (From: Ken Anderson <email@hidden>)
 >Re: EOOrQualifier generated from an array (From: Pierre Bernard <email@hidden>)

  • Prev by Date: Re: EOOrQualifier generated from an array
  • Next by Date: Wonder project
  • Previous by thread: Re: EOOrQualifier generated from an array
  • Next by thread: Wonder project
  • Index(es):
    • Date
    • Thread