I have to create a report, that should print a list of all the vendors that do not have any vendor ledger entries in the last two years. Any suggestions How I can do this.
So far, I have a two dataitems: Vendors and Vendor Ledger entries (indented under it).
I am just not sure how to check if a vendor has any ledger entries in the last two years.
0
Answers
RIS Plus, LLC
How can I make it show the vendor information if there were no vendor ledger entries in the last two years...I am not sure which item to set the filter on...
Vendor Ledger Entry - OnPreDateItem
If you need to create a list report that shows the vendors that do not have any vendor ledger entries for the past 2 years, does it make sense to have a dataitem that shows vendor ledger entries? In my opinion no. Why would you have a dataitem for a table from which you are not going to show any data? You have to think about this.
Instead of a dataitem, add some code to the OnAfterGetRecord trigger of the Vendor, and use the CurrReport.SKIP method to skip over vendors that DO have ledger entries. Since you are not showing any details, you don't need to actually retrieve and records, so you can use the ISEMPTY command.
RIS Plus, LLC
You are looping where you don't need to loop. All you need to do is know whether records exist, like this:
Also, your date filtering can be done better: No need for 4 different variables, and it's easier to use SETRANGE. Also, I don't know where 'CD' comes from
RIS Plus, LLC
CD was ment to be "Current Date". I wasnt sure how to tell the system to calculate the 2 year difference. Thats why I used CD (current day) - 2y.
your way makes a bit more sense. :thumbsup: