Salvador
Salvador

Reputation: 16492

is possible filter a TClientDataset using a insensitive case?

i need to filter a TClientDataset, actually i'am using this code.

  if Value<>'' then
  begin
      ClientDataSet1.DisableControls;
      try
        ClientDataSet1.Filtered := False;
        ClientDataSet1.Filter   := 'Value LIKE ' + QuotedStr('%'+Value+'%');
        ClientDataSet1.Filtered := True;
      finally
        ClientDataSet1.EnableControls;
      end;
  end;

but the filter is working in case-sensitive mode, is posible filter the record ignoring the case?

Upvotes: 4

Views: 4451

Answers (1)

RRUZ
RRUZ

Reputation: 136451

you must use the FilterOptions property with the foCaseInsensitive value.

  ClientDataSet1.DisableControls;
  try
    ClientDataSet1.Filtered := False;
    ClientDataSet1.FilterOptions := [foCaseInsensitive];
    ClientDataSet1.Filter   := 'Value LIKE ' + QuotedStr('%'+Value+'%');
    ClientDataSet1.Filtered := True;
  finally
    ClientDataSet1.EnableControls;
  end;

Upvotes: 14

Related Questions