Re: String Qualifier for Number
Re: String Qualifier for Number
- Subject: Re: String Qualifier for Number
- From: Chuck Hill <email@hidden>
- Date: Fri, 14 Mar 2008 08:11:02 -0700
On Mar 13, 2008, at 4:48 PM, shaun wrote:
Chuck Hill wrote:
On Mar 13, 2008, at 10:47 AM, Carter Wojcik wrote:
Hi All -
My users want to have the ability to search on a
Number attribute, but use String qualifiers such as
Contains ('*value*'), Begins With ('value*'), Ends
With ('*value').
I have a table named part that contains a primaryKey
named part_id (Number and exposed) and a String called
descriptor.
Is there a way to create an EOQualifier that
replicates the SQL in the example below?
Example: Select all parts with a part_id that begins
with 3.
select * from part where to_char(part_id) like '3%';
Maybe...
Add a new attribute called partIDAsString
Set the column to part_id
Set the datatype as string
Mark it as read only
Set the read format to to_char(%P)
Then make a qualifier on partIDAsString.
Interesting approach. I hope it works.
Apparently, it does. :-) It has been a few years since I used that.
The other day I was trying to do exactly the same thing as descibed
by Carter.
I used the Wonder RegExQualifier class as a base for my own
EOQualifier implementation and created the sql as required calling
to_char(id)
it was all going well up until it actually had to do the fetch,
thats when JDBCColumn in the JDBCAdaptor classes got in the way and
spoiled the fun; it checks that the object type provided matches the
models type but '01%' is NAN so it throws an Exception. I'm not
sure if there is somethign i can do to get around this or not?
I am pretty sure that you can, but writing qualifiers is tricky and
can lead to rapid loss of hair. The modelling approach is far easier.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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