rdbgrid_ms optionsext2.filters.TextFilterType:=oftStartPos does not works

29 views
Skip to first unread message

Belmax Beograd

unread,
Aug 3, 2023, 10:53:12 AM8/3/23
to Rosi Delphi Components
i have rdbgrid_ms with lookupcombobox column but it filter lookup table on only any pos filter
oftAnypos,
but oftStartPos does not work.
I have try oftAnyposForNoLikechar too
but it does not work !
Regards

Tomas Rosinsky

unread,
Aug 3, 2023, 11:54:16 AM8/3/23
to Rosi Delphi Components
Hi, 
OptionsEx2.filters.TextFilterType setting is used for filtering of grid dataset only. 
Lookup dataset used for lookup field is filtered always with anyPos setting.

Anyway it could be updated easily if needed in the source code so I will implement it in the next version.
In meantime you can update 
  function TrDBGrid.SearchGetFilterString(Fld: TField): string;

to be similar as 
  procedure GetTextCond(CondText: string);

I hope it helps
Tomas

Dne čtvrtek 3. srpna 2023 v 16:53:12 UTC+2 uživatel Belmax Beograd napsal:

enver penjo

unread,
Jul 26, 2024, 10:41:01 AMJul 26
to Rosi Delphi Components
i make this, but it would be nice to make this official:
:
function TrDBGrid.SearchGetFilterString(Fld: TField): string;
var
  LikeCh: string;
begin
  Result:='';
  if not Assigned(Fld) then
    Exit;
  if Fld is TBooleanField then
    // just use cell value
    Result:=GetFilterCond(Fld, GetBooleanFieldTextValue(Fld, Fld.AsBoolean), Fld.IsNull, '')
  else
    if (Fld is TNumericField) or rdbtool.IsDateTimeField(Fld) then
      // just use cell value
      Result:=GetFilterCond(Fld, Fld.AsString, false, '')
    else
      if rdbtool.IsApostrField(Fld) then
      begin
        LikeCh:=FOptionsEx2.FFilters.GetTextFilterLikeChar;

      case FOptionsEx2.FFilters.FTextFilterType of
        oftAnyPos:
        Result:=GetFilterCond(Fld, LikeCh + FSearchText + LikeCh, false, FOptionsEx2.FFilters.GetTextFilterLikeOperator);
        oftStartPos:
        Result:=GetFilterCond(Fld, FSearchText + LikeCh, false, FOptionsEx2.FFilters.GetTextFilterLikeOperator);
        oftExactValue:
          ;
      {  oftAnyPosForNoLikeChar:
          if Pos(LikeCh, CondText) = 0 then
            CondText:=LikeCh + CondText + LikeCh; }
      end;
      //  Result:=GetFilterCond(Fld, LikeCh + FSearchText + LikeCh, false, FOptionsEx2.FFilters.GetTextFilterLikeOperator);
      end;
end;

Tomas Rosinsky

unread,
Aug 4, 2024, 10:28:47 AMAug 4
to Rosi Delphi Components
Thanks for the suggestion. It is question if the FilterType set and used for text filter in title row should be used also for lookup search and grid search.
I will evaluate this possibility and probably implement in some way.

Tomas
Dne pátek 26. července 2024 v 16:41:01 UTC+2 uživatel penj...@gmail.com napsal:
Reply all
Reply to author
Forward
0 new messages