TBufDataset Filter by Field that has a space in the field name. lazarus / 63-Database ---------------------------------------------------------------------- dmitryb · 2021-08-19 01:55 Hi All How to assign Filter property of the TBufDataset if a field has a space in the name? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   BufDataset2.Filter := 'FieldName WithSpace = ''Value1''';  BufDataset2.Filter := '[FieldName WithSpace] = ''Value1'''; does not work. Here is a Test code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button3Click(Sender: TObject);var  BufDataset2: TBufDataset;begin  BufDataset2 := TBufDataset.Create(nil);   BufDataset2.FieldDefs.Add('FieldName WithSpace', ftString, 200);  BufDataset2.CreateDataset;  BufDataset2.AppendRecord(['Value1']);  BufDataset2.AppendRecord(['Value2']);  BufDataset2.Filter := 'FieldName WithSpace = ''Value1''';  //BufDataset2.Filter := '[FieldName WithSpace] = ''Value1''';  BufDataset2.Filtered := True;end; ---------------------------------------------------------------------- kjteng · 2021-10-28 10:49 I think the parser cannot handle field name containing spaces. However,  you can do the filtering via DoFilterRecord event. Something like this: procedure TForm1.xxFilterRecord(DataSet: TDataSet; var Accept: Boolean); begin    accept := dataset.Fieldbyname('FieldName WithSpace').AsString ='Value1'; end;