tags:

views:

101

answers:

1

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?

+9  A: 

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;
RRUZ