Skip to main content

Random Inventory

editSubscribe (0) ShareShare
Posted on by 265

Hi all, i'm using Dynamics NAV and my goal is to use Report 790 (Calculate Inventory) to make monthly inventories.

It should generate a random maximum number of products for the user to check.

In the InsertItemJnlLine function I created a variable that counts the number of rows after the journal entry:
Count Lines: = Count Lines + 1;
Then at the end I put the following code:

IF (Count Lines> NumberProducts) AND (NumberProducts <> 0) THEN

Where NumberProducts is the variable that chooses the quantity of products to be inventoried.

But this will only show the number of products I've bound, and does not traverse the table item randomly, this is my first difficulty.
Another difficulty is:
Imagine that 50 products are chosen each month. How do I avoid these 50 products being "chosen" next month.
I thought about creating a variable in the item table, where whenever this report runs, that field is populated with the date and then only apply the filter if that field is empty. Is this acceptable?