Subject RE: [IBO] Filter
Author Jason Wharton
> I'm applying the filter like this:
>
> qrForm.Filtered := False;
> qrForm.Filter := 'upper(cli.NOME) LIKE ' + QuotedStr('TIAGO%');
> qrForm.Filtered := True;
>
> IBO raises an exception. If it helps, here goes the MadExcept
> call stack:
>

Just a hint for future reference...

There are case sensitivity features built into IBO that you may want to take
notice of.

For example, you can have an uppercase version of the NOME column in your
database and set a column attribute to tell IBO what the name of the column
is. Then, instead of having SQL as you have above that cannot be optimized
by an index you can have IBO automatically substitute NOME_UPPER in the
place of UPPER( NOME ) just by using NOME alone in your filter text.

The purpose of this is to have your application function as if the column
was case insensitive but to use mixed case. IBO takes care of all the
necessary substitution behind the scenes to make it all work.

So, if you had an alternative column in your database that a trigger
maintains called NOME_UPPER and the proper setting in the ColumnAttributes
property, your code could look like this:

qrForm.Filtered := False;
qrForm.Filter := 'NOME LIKE ' + QuotedStr('TIAGO%');
qrForm.Filtered := True;

and what gets sent to the server by IBO would look like this:

WHERE ( cli.NOME_UPPER LIKE 'TIAGO%' )

Which, if you have an index on that column will make your query much faster
and keep your code simple.

This feature is why you ran into trouble because IBO parses out the filter
text and makes these substitutions for you automatically based on the
settings in the ColumnAttributes property.

Hope this helps,
Jason Wharton