Board index » delphi » Filter :I really need help !

Filter :I really need help !

Hi !

 I'm using Delphi 4 and I have a problem of filter :

This is my program :

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Grids, DBGrids, Db, DBTables;
type
  TForm1 = class(TForm)
    DataSource1: TDataSource;
    Table1: TTable;
    DBGrid1: TDBGrid;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Dclarations prives}
  public
    { Dclarations publiques}
  end;

var
  Form1: TForm1;

implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
table1.filtered:=true;
table1.active:=true;
table1.filter:= '''code_artic'' = ''V1912'''; <<<<<<<<<<<<<<<<<    PROBLEM
???????????
end;
end.

 I think the problem comes from the noticed sentence, isn't it?. Maybe it is
synthax error but I'm quite not sure : I don't know how to solve it. Could
you help me?
Thanks.

 

Re:Filter :I really need help !


Quote
> table1.filter:= '''code_artic'' = ''V1912'''; <<<<<<<<<<<<<<<<<    PROBLEM
> ???????????

I think what it should be is :-

table1.filter := 'code_artic = "v1912"'

You can treat the filter just like the WHERE part in a SQL statement.  Hope
this helps,

Ashley

Re:Filter :I really need help !


Quote
>table1.filter:= '''code_artic'' = ''V1912'''; <<<<<<<<<<<<<<<<<    PROBLEM
>???????????
>end;
>end.

> I think the problem comes from the noticed sentence, isn't it?. Maybe it is
>synthax error but I'm quite not sure : I don't know how to solve it. Could
>you help me?
>Thanks.

Something like this would work much better:

Table1.Active := True;
table1.Filtered := False;
table1.Filter :=  'code_artic = '  + QuotedStr('V1912');
table1.Filtered := True;

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

Other Threads