I have created a new Role Centre based on code from Microsoft Learn, and I am now attempting to expand its functionality.
I have created a custom query; see the code below:
query 50130 "Custom Ledg. Entry Sales"
{
QueryType = Normal;
elements
{
dataitem(CustLedgerEntry; "Cust. Ledger Entry")
{
column(SumsalesLCY; "Sales (LCY)")
{
Method = Sum;
}
filter(DocumentTypeFilter; "Document Type")
{
}
filter(PostingDateFilter; "Posting Date")
{
}
filter(PaymentMethodFilter; "Payment Method Code")
{
}
}
}
}
The 'Document Type' is an options field, and 'Payment Method Code' is an optional field using a lookup table.
The code to set the filters is below:
Expr2 := 'FARMFIT';
CustLedgEntrySales.SetRange(DocumentTypeFilter,
CustLedgEntry."Document Type"::Invoice);
CustLedgEntrySales.SetRange(PostingDateFilter,
CalcDate('<-CM>', Workdate), Workdate);
CustLedgEntrySales.SetFilter(PaymentMethodFilter,
CustLedgEntry."Payment Method Code", '%1', Expr2);
The filters for the PostingDateFilter and DocumentTypeFilter appear to work as expected.
However, I now want to select Invoices and Credit Memos using the DocumentTypeFilter.
Question: How do you write the code to select more than one document type?
I have not been able to use the PaymentTypeFilter successfully; the calculation always includes all Payment Method Codes. I am not sure if this is related to the fact the field is a lookup field
Question: Is there a method for using filters on lookup fields?
Any assistance would be much appreciated.
Thank you in advance for your help.