I am stuck with creating the multidimensional array in 'Modified javascript' step I have the input like
ID Product Sale
1 Fruits 10
2 Biscuit 20
1 Fruits 12
3 Beer 29
I am trying to create the javascript to add those columns values in multidimensional array and sort based on 'Product', then will try to sum the sales based on 'Product'. Expected Output: id 1-> Fruits -sales(10+12)=22 Can you please help to solve this using javascript array or map? I have done this using kettle steps like 'groupby' but need to solve this by javascript.
What you are trying to accomplish is not possible using javascript. The step "Modified Java Script Value" works in a per row way, so it doesn't have access to the whole set of data, but only to the currently being processed record.
You can accomplish that by using the "Group by" step. In this case, your "ID" or "Product" should be the Group field, while "Sale" should be the "Subject". Finally, the type should be "Sum".