@GPT2
Please follow the below approach:

Product Table:

Resulted Datatable:

Code:
SET resultTable TO { ^['Customer Code', 'Customer Name', 'Product', 'Quantity'] }
SET Producttable TO { ^['Customer Code', 'Customer Name', 'Product', 'Quantity1', 'Quantity2', 'Quantity3', 'Quantity4'], [1234, 'John', 'Apple', 2, 3, 3, ''], [1234, 'John', 'Mango', 1, 0, 2, 0], [1234, 'John', 'Peach', 2, 2, 1, 0], [12345, 'Carl', 'Apple', 2, 1, 0, ''], [12345, 'Carl', 'Mango', 5, 3, 0, 0], [678, 'Ben', 'Peach', 1, 3, 4, 1], [678, 'Ben', 'Mango', 5, 3, 4, ''] }
LOOP FOREACH CurrentProductItem IN Producttable
LOOP LoopIndex FROM 1 TO 4 STEP 1
IF IsNotEmpty(CurrentProductItem['Quantity' + LoopIndex]) THEN
SET RowValue TO [CurrentProductItem['Customer Code'], CurrentProductItem['Customer Name'], CurrentProductItem['Product'], CurrentProductItem['Quantity' + LoopIndex]]
Variables.AddRowToDataTable.AppendRowToDataTable DataTable: resultTable RowToAdd: RowValue
END
END
END
Thanks,
Deenuji Loganathan 👩💻
Automation Evangelist 🤖
Follow me on LinkedIn 👥
-------------------------------------------------------------------------------------------------------------
If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀