Board index » delphi » "AND"-statement in TTable filter?

"AND"-statement in TTable filter?

Hi,

I can use Filter-property with an integer or with a string but I can not
use a statement like

Table2.Filter:='Number=2 and Name='Joe''

What is the correct syntax for this statement?

Kay

 

Re:"AND"-statement in TTable filter?


Quote
>Hi,

>I can use Filter-property with an integer or with a string but I can not
>use a statement like

>Table2.Filter:='Number=2 and Name='Joe''

>What is the correct syntax for this statement?

>Kay

Try this:

Table2.Filter = Number = 2 and Name = ' + quotedStr('Joe');

I did a test on the DBDEMOS table customer.db and this filter worked:

Table1.Filtered := False;
    Table1.Filter := 'Addr2 = ' + QuotedStr('Suite 310') + ' and company = ' +
        quotedStr('Blue*') ;
    table1.Filtered := True;

and this as well

Table1.Filtered := False;
    Table1.Filter := 'Addr2 = ' + QuotedStr('Suite 310') + ' or company = ' +
        quotedStr('Blue*') ;
    table1.Filtered := True;

to prove that not only "and" will work but also "or".

********************************
Michael Glatz              
glatzfa...@aol.com
mgl...@netzero.com
Accept that some days you're the pigeon,
some days you're the statue.

Other Threads