Board index » delphi » Setting Filter in Code

Setting Filter in Code

I can't seem to be abe to write code which sets a filter.

Consider a field, "Payee" in Table1.

I want to write some code like:

Table1.Filter:= . . . . . .

Case 1.
Set the filter so that only records with the field "Payee" = 'Eve'

Case 2
Set the filter so that only records with the field "Payee" = 'Eve' or
"Payee = 'John'

Help will be appreciated.

Wil

 

Re:Setting Filter in Code


Quote
>Table1.Filter:= . . . . . .

>Case 1.
>Set the filter so that only records with the field "Payee" = 'Eve'

Table1.filter = 'Payee = '+QuoteStr('Eve');

Quote
>Case 2
>Set the filter so that only records with the field "Payee" = 'Eve' or
>"Payee = 'John'

Tbl1.filter='Payee = '+QuoteStr('Eve')+' or Payee ='+QuoteStr('Jhon');

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Re:Setting Filter in Code


Thanks for the info.  I never knew that the QuotedStr function was
present.  Just to keep set the record straight, its name is "QuotedStr"
not "QuoteStr".

Thanks for the help.
Wil

Quote
Brian Bushay TeamB wrote:
> >Table1.Filter:= . . . . . .

> >Case 1.
> >Set the filter so that only records with the field "Payee" = 'Eve'

> Table1.filter = 'Payee = '+QuoteStr('Eve');

> >Case 2
> >Set the filter so that only records with the field "Payee" = 'Eve' or
> >"Payee = 'John'

> Tbl1.filter='Payee = '+QuoteStr('Eve')+' or Payee ='+QuoteStr('Jhon');

> --
> Brian Bushay (TeamB)
> Bbus...@DataGuidance.com

Re:Setting Filter in Code


Quote
>Thanks for the info.  I never knew that the QuotedStr function was
>present.  Just to keep set the record straight, its name is "QuotedStr"
>not "QuoteStr".

myspelling slips with aout a syntax checker  ;-( quotedStr is correct

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Other Threads