Is there a Knime node that can generate sequence numbers in a column based on the row output of a group by node? Any suggestions?
Hi,
what kind of sequence do you want to create? Can you give a short example?
Thanks,
Tobias
For example, my output is:
COL1COL2COL3
XXX AAA ABC
XXX AAA ABC
XXX AAA ABC
XXX BBB ABC
XXX BBB ABC
YYY CCC ABC
YYY CCC XYZ
YYY CCC XYZ
YYY CCC XYZ
And I want to create a sequence number column based on the combination of unique values of COL1 and COL2 so my sequence column would look like this:
COL1COL2COL3SEQ#
XXX AAA ABC 1
XXX AAA ABC 2
XXX AAA ABC 3
XXX BBB ABC 1
XXX BBB ABC 2
YYY CCC ABC 1
YYY CCC XYZ 2
YYY CCC XYZ 3
YYY CCC XYZ 4
Thanks
Jon
Hi Jon,
please see the attached example <href=“www.knime.org/files/sequenceData.zip”>sequenceData.zip in order to do this task using the Java Snippet node.
Best, Thomas
Many thanks gabriel. That’s what I’m looking for.
Regards
not able to download the zip file(sequenceData.zip)..kindly help.
Not able to dowload .zip file :(
Also unable to download the zip file. Could you please provide a new link or written instructions?
Can anyone provide the mentioned file or another solution?
Hi there,
if you what to do it in a more KNIME way you can use Group Loop Start node together with Counter Generation node. Here is workflow print screen:
And here is workflow attached to check it out:
2019_06_18_Generate_Seqence_Within_Group.knwf (13.7 KB)
Br,
Ivan
Also, look at
node. It does not require loop.
The easiest way I found is to use $$ROWINDEX$$ + 1 expression in Math Formula node. It also doesn’t require loop but also preserve row order of the original data and fits better if you need to start sequence from specific number.
Hello @mkurilov,
welcome to KNIME Community!
That is indeed the easiest way in case you only need one sequence. In case you need to have multiple sequences based on group then it can not be used.
Br,
Ivan