Thema: Delphi Filterproblem mit TTable

Einzelnen Beitrag anzeigen

Grolle

Registriert seit: 5. Nov 2004
Ort: Coesfeld
1.268 Beiträge
 
Delphi 2010 Professional
 
#21

Re: Filterproblem mit TTable

  Alt 10. Dez 2006, 21:27
Hi,
hier der Text:
Delphi-Quellcode:
procedure TForm1.AdsTable1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
begin
  //if not AdsTable1.FieldByName('def3').IsNull then
  Accept := Form6.Match(VarToStr(DataSet['def3']),Form6.sMatch);
end;

procedure TForm6.Button1Click(Sender: TObject);
begin
  sMatch := MatchStr(Edit1.Text);
  Form1.AdsTable1.Filtered := true;
  edit1.Text := '';
  Close;
end;
Die anderen Filter rufe ich aus einem PopUp-Menü auf:
Delphi-Quellcode:
procedure TForm1.MenuItemClick(sender : TObject);
var
s, g : string;
begin
  with Sender as TMenuItem do
    if count = 0 then
      begin
        s := Caption;
        s := StringReplace(s,'&','',[rfReplaceAll]);
        g := parent.Caption;
        g := StringReplace(g,'&','',[rfReplaceAll]);
        if s = lng.GetValue('topitem') then ADSTable1.Filtered := False
        else if s = 'Special Filterthen Form6.Show
        else if s = lng.GetValue('nodeitem') then
          begin
            AdsTable1.Filter := 'node = "'+g+'"';
            AdsTable1.Filtered := true;
          end
        else
          begin
            if g = 'then
            begin
              AdsTable1.Filter := 'node="'+s+'"';
              AdsTable1.Filtered := true;
            end
            else
            begin
              AdsTable1.Filter := 'node = "'+g+'" .AND. tree="'+s+'"';
              AdsTable1.Filtered := true;
            end;
          end;
      end;
end;

  Mit Zitat antworten Zitat