Hi there,
Hoping somebody can give me the hint to solve my small riddle. In essence I would like to pre-filter for overdue invoices with the help of a query (see below for AL code). That works fine if I am using a hardcoded solution by specifying a day for the 'ColumnFilter' within the dataitem. E.g. if today is the 20th of a month the code is returning all invoices summed up until the 19th of the current month.
Now, obvious that's not a solution that works for every day of a month. I thought, I could achieve my goal by setting the filter via the trigger method, but the return results are identical with a non-filtered item.
Please tell me, what am I missing for a dynamic solution?
PS: this
answer didn't worked for me
query 10001 SummedUpInvoices
{
Caption = 'Open Invoices'; // without any date filter
//Caption = 'Overdue Invoices'; // with date filter 'earlier than today' applied
QueryType = Normal;
QueryCategory = 'Sales Invoice List';
elements
{
dataitem(SalesInvoiceHeader; "Sales Invoice Header")
{
column(JobNo; "Job No.")
{
}
filter(DueDate; "Due Date")
{
// ColumnFilter = DueDate = filter(< 20); // hardcoded, non-dynamical solution
}
column(AmountIncludingVAT; "Amount Including VAT")
{
Method = Sum;
}
}
}
trigger OnBeforeOpen()
begin
TodayDate := Today();
//CurrQuery.SetFilter(DueDate, '< %1', TodayDate); // dynamic approach, but doesn't work
end;
var
TodayDate: Date;
}