I am implementing a new report system in my company. The transfer of data from ERP to the report builder software is handled with a temporary JSON array.
Within the report builder I can manipulate the data with C#. Currently I am working on a new report for our shipping labels. Sometimes (not always, pseudocode follows) I need to print multiple labels of the same kind.
I think the easiest way to achieve this would be by iterating through the array and duplicate the entries according to my logic. I could put this code in the "DoBeforeYouPrint"-Void of my report then and should get the desired amount of labels.
The data looks something like this (simplified)
{
"CustomerID": "1337",
"ArticleName": "Strawberry",
"DeliveryWeek": "45",
"PackagingCount": "50"
}
Pseudocode:
x = PackagingCount
y = Number of extra rows (labels)
foreach (Entry in DataSource) {
if x < 48 then
{
y = Math.Ceiling(x / 12)
}
if else x >= 48 then
{
y = Math.Ceiling(x / 60)
}
if else x > 840 then
{
y = 14
}
for (i = 1 to y)
{
Duplicate(Entry);
}
}
I need help with a function that will do the duplication of the row and copy all information into an identical new row directly beneath the original row.
Is this possible at all with JSON arrays? I am not a real programmer, I work in a greenhouse.