Subject RE: AGAIN - [IBO] Search question
Author Nico Callewaert
Hi,

I changed the OnPrepare statement of the query like this :

if CheckBox1.Checked then
SQLWhereItems.Add ('UPPER (NAME) STARTING WITH :NAME');
else
SQLWhereItems.Add ('UPPER (NAME) CONTAINING :NAME');

After the user selects another option, I do a InvalidateSQL, so I'm sure the
statement will be reprepared with the right SQLWhereItems. When the user
enters a text in the EditSearch component, and presses enter, I'm having a
AccessViolation at address .... The strange thing is, the result set is
correct.

Any idea ?

Thanks, Nico Callewaert


-----Oorspronkelijk bericht-----
Van: Harald Klomann [mailto:nibler@...]
Verzonden: vrijdag 23 maart 2001 10:54
Aan: IBObjects@yahoogroups.com
Onderwerp: Re: [IBO] Search question


Nico Callewaert wrote:
>
> Hi,
>
> I have a form for searchedit connected to a query, in the
OnPrepare
> statement, I have a line like this : .... SQLWhereItems.Add ('UPPER
(NAME)
> STARTING WITH :NAME');
> Now a user is asking me if it is possible to search for a string not
> starting with, but like a substring.
> I think I can solve it with : .... SQLWhereItems.Add ('UPPER (NAME) IN
> :NAME'); ???
> Right ?

> Do I need 2 SearchEdit components for it ? In case if, if the user
would
> switch between the 2 search modes, I guess I have to reprepare the
statement
> with the right SQLWhereItems clause ?
> Or is there a better way for this ?
>
> Thanks,
>
> Nico Callewaert
>

Nico,

>> SQLWhereItems.Add ('UPPER (NAME) IN :NAME');

This will not work, use SQLWhereItems.Add ('UPPER (NAME) CONTAINING
:NAME');

> But the problem then is, how will I make a difference between the 2,
because
> user A will intend to look for a name STARTING WITH, and user B would
like
> to search on a substring in that name.

Use a switch on your form, like a checkbox with the text maybe Starting
with / Containing
In the OnPrepare statement, just evaluate the switch, like :


if CheckBox1.Checked then
SQLWhereItems.Add ('UPPER (NAME) STARTING WITH :NAME');
else
SQLWhereItems.Add ('UPPER (NAME) CONTAINING :NAME');


Harald

Yahoo! Groups Sponsor

Click Here to Find Software Faster


Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]