I'm trying to set up a filter with the actual year and month.
Database is MSSQL.
I added DateUtils
to my uses. How can I set up the filter expression to use the YearOf()
function?
How can I add more than one line filter expression? Is this possible?
This is working:
with FDQuery2 do begin
Filtered := False;
Filter := '"Posting Year" = 2021'; //+ 'Posting month = January'
Filtered := True;
end;
Unfortunately, this returns me an error:
with FDQuery2 do begin
Filtered := False;
Filter := '"Posting Year" = YearOf';
Filtered := True;
end;
How can I add a second filter expression?
UPDATE: I used now a little workaround to avoid much more work due to converting TDateTime
, etc.
var
YearFilter: string;
YearFilter := IntToStr(CurrentYear);
question from:
https://stackoverflow.com/questions/65898683/delphi-tfdquery-filter-for-multiple-expressions-and-yearof 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…