Duplicate rows based on a given value of the cell

Hi Knime Community, I’m not sure how to execute this, the task is to add/duplicate the row based on the number of claim quantity, if the claim quantity is 7 then the row for that specific data should be also 7 (it creates each row based on the # of claim qty). I did try the unpivot but since the reference is in the cell value itself it does not reflect. I’m also thinking of adding a counter generation but I’m not sure where to go from there.

Here is the initial format:

This should be the final format (sample/reference Row0):

Hi @Heldyyyyy

Try the One Row to Many node.

gr. Hans


Hi @HansS This node works, thank you! I want to add another question :sweat_smile: is it also possible for Claim/Rebate amount to be divided to the number of claim quantity? For ex. If claim rebate is 50 and claim quantity is -7, then it will have 7 rows but the claim rebate would be 50/7 = 7.14. Is this possible through like a string manipulation or rule engine where I will call the duplicate values and if they are true then it will divide to the number of quantity.

@HansS Additionally, I just noticed that when I used this formula, it converts the values of that integer into positive. For example, if the initial integer value is -5, when applied to this one-to-many node, it becomes 5 instead of -5. It seems that “-” or with negative values it does not recognize as integer

Update: I did find a way to include the negative values since negative values does not recognize as integer/does not recognize in the one to many node. I just used row filter by its negative and positive values then apply the one to many node separately then join them again using concatenate. Thanks again for your help!


1 Like

Glad you can move on with your project.
Happy KNIMEing
gr. Hans

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.