We have this packing list report that we need to put pallet no. Column. Per sales line. Ex. Is that if we have an item no. With 1000 qty, if this item has 200cases per pallet,the item needs to split into 5 lines with qty 200 cases and with pallet no. 1 to 5. This will repeat for all the sales lines given the no. Of cases per pallet as maximum qty per line. Kindly help me with this one please...🙏. Thank you.
In that case the simplest thing would be to create a global Temporary Table for your lines in the OnAfterGetRecord trigger of the header. And then use the Temporary Table as source for your Lines dataitem (and put it's property on temporary too).
You just loop through your record with the Lines (that is not Temporary).
For each line, get the Item and check that "No. Of Cases Max" has a value.
If its 0 then you don't need to split and you can just add the entire line to the Temporary Table.
If it is anything else (preferably a positive number ofcourse ), then you need to continue in code to split it.
And then just create the loop, so that would get you the code below
Hopefully this gives you an idea of how to do it.
I believe this is the cleanest way to get your report with more lines, while keeping it in Business Central on a single line.