Hello Experts,
Right now I'm working on a report. I have taken two DataItems: Item Ledger Entry & Item Journal Line. Now I need to set four request page filters i.e. Item No., Location Code, Entry Type, Posting Date(Start Date, End Date).
For that I have taken five variables in C/AL Global i.e. Item No.(Code), Location Code(Code), Entry Type(option), Start Date(Date), End Date(Date).
I have also declared those fields on Request Page Designer.
Now I have written the following code:
Item Ledger Entry----- OnPreDataItem():
SETRANGE(Item Ledger Entry.Posting Date, Start Date, End Date);
SETRANGE(Item Ledger Entry."Item No.", "Item No.");
SETRANGE(Item Ledger Entry.Location Code, Location Code);
SETRANGE(Item Ledger Entry.Entry Type, Item Ledger Entry.Entry Type :: "Negative Adjustment");
The code has run but whenever I enter any values on the request page the report doesn't shows any data. If I left those fields empty the report shows all the data. I have no clues how to correct it. Please Help me!
*This post is locked for comments
What is your exact requirement? What is the end result that you are trying to achieve?
I would not recommend to use Item Ledger Entry as data item. Instead you should use ItemLedgerEntry as variable to get the desired result.
Hello Rajat,
Do one thing first run the table Item Ledger entry with those filters, and check you are getting data or not.
If you get the data, then run report with "About This Report" [After running the Report, you can find under Help Menu, See the bellow screenshot].
Once you will get data on "About This Report" window then intimate us, we will give you solution.
Hi Rajat,
I rewrote your code and with a small change I was able to make it happen. Try and let me know.
Item Ledger Entry --- OnPreDataItem() indication := (ItemNo <> '') OR (LocationCode <> '') OR (StartDate <> 0D) OR (EndDate <> 0D) OR (EntryType <> 0); IF indication THEN BEGIN "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Posting Date", StartDate, EndDate); "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Item No.", ItemNo); "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Location Code", LocationCode); "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Entry Type", EntryType); END;
indication will be a Global C/AL variable - Type Boolean.
Hope it helps.
do you have records in combination of all those filters.
I guess you didn't have records in table as you are getting if you apply only 1 at a time.
the filters applied as AND and not OR statement.
Yeah it has some..but if I only run a single unit of code by keeping others within the comment {} then I'm getting the desired result but only for a single field at a time.
Thanks.. & please suggest what else I can do?
do you have data with above filters? Please check Item Ledger Entries
Hi,
I would recommend using setfilter for dates, and why you are specifying the entry type as negative in the codes?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156