Re: Searching on every field related to an object?
Re: Searching on every field related to an object?
- Subject: Re: Searching on every field related to an object?
- From: email@hidden
- Date: Wed, 26 Nov 2003 12:32:56 CDT
- Priority: 3 (Normal)
[demime could not interpret encoding binary - treating as plain text]
I can't think of any way to do it beyond what you seem to already have in
mind: query the model for all attributes (and possibly relationships),
manually build up the qualifier with a bunch of key value qualifiers and
an EOOrQualifier.
It is not hard to investigate the model though. Look at EOEntity,
EOAttribute, and EORelationship. They have all the methods you need to
pretty easily get a list of all relevant attributes.
There is one thing to keep in mind though: When relationships are
involved, and those relationships are optional, and when 'or' is
involved, it can be tricky to get the SQL generated that really does what
you want. Even without EOF it can be tricky to write this SQL. With EOF,
it can be even trickier to convince EOF to generate this SQL. Pay
attention to a hypothetical row that doesn't in fact _have_ any objects
at the end of the relationship---the SQL generating the join for that
relationship will end up ruling out that row, even if one of it's own
attributes matched your string.
That's not the issue you were asking about, but that's the issue that
will probably give you the most trouble. Examining the EOEntity for it's
relevant attributes and relationships and building the qualifier, that
should be no problem. The problem is that the qualifier may not do what
you want. [If you left out relationships, and it was just simple
attributes, this problem would not exhibit].
--Jonathan
On Tue, 25 Nov 2003 18:36:05 -0700 steve stout wrote:
> I'm looking for an easy way to build a qualifier in WO that will allow
> me to search on every char field related to an object. Including
> relationships.
>
> I have an Order table, with relationships to Customer and other tables
> like the item they ordered, etc. I'd like to put one text box on the
> page and be able to enter any string into that field and retrieve any
> Order object that has that text in any of its fields and related
> fields. For example, the person types in a phone number, then any
> Order with a relationship to a Customer that has that phone number will
> be returned. Or a name could be typed in, or an address.
>
> I'm just wondering if there's an alternative to creating lots of
> EOQualifiers and ORing them together. Or if there's an easy way to
> query the EOModel and dynamically build a qualifier.
>
> I'm using an OpenBase database if there's any trick that might help out
> with that.
>
> Thanks.
>
>
>
> ///---------------------------------------
> steve stout
> web coordinator
> arizona student unions
> 52o.626.o1o9
>
> http://www.union.arizona.edu
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.