Hi There!
I am looking for a way to split my original row into multiple rows based on specific information in that row.
Example
If my data looks like this.
Date | Description | Number | Amount |
01-01-2018 | 1-5kg | 5 | 100 |
I want it to generate rows automatically based on the value in "Number" and then split the value in the column amount evenly out to the generated rows. Furthermore, when done the original row should be removed.
So my output would look like this.
Date | Description | Number | Amount |
01-01-2018 | 1-5kg | 1 | 20 |
01-01-2018 | 1-5kg | 1 | 20 |
01-01-2018 | 1-5kg | 1 | 20 |
01-01-2018 | 1-5kg | 1 | 20 |
01-01-2018 | 1-5kg | 1 | 20 |
Hope you can help me.
BR
Solved! Go to Solution.
Hey @jonasheise!
I think the tool you need is the Generate Rows tool. The configuration I would recommend looks like this:
This will generate however many rows it needs until the RowCount field equals your Number field. Next, I would add a Formula tool with the following expression:
[Amount]/[Number]
Hey @BarnesK
Thanks for quick reply! I think you almost helped me to my goal, however I encounter this problem. Can you help me out?
Futhermore, would the equation/function in the formula tool have to look different If I got a data table like this?
Date | Description | Number | Amount |
01-01-2018 | 1-5kg | 5 | 100 |
02-02-2018 | 5-10kg | 7 | 300 |
For the error, I would say make sure the RowCount field you are creating is a numeric data type and the Number field flowing through it also a numeric data type.
Also, everything should work as expected regardless of the number of records flowing through. Depending on how many decimal places you want, you may have to adjust the data type of your Amount field. Below I made it a double using a Select tool before the Formula.