Help Needed: Connecting IDs in Reverse Order and Generating Columns for Each ID in KNIME

Hi everyone,
I’m currently embarking on a project in KNIME and have stumbled upon a hurdle that I hope someone in this community could help me navigate. My objective is to link a series of IDs in reverse order, initiating with the last ID in the chain. For each ID, I aim to generate a new column, organizing the IDs horizontally in the resultant table.
To paint a clearer picture, I’m aspiring to achieve an output similar to the format below:

ID | 1 | 2 | 3 | 4 | 5
1111 | 4477 | 4301 | 4268 | 4231 | 4197
2222 | 5000 | 4000 | 6000 | 3000 | ?

In this layout, each row represents a chain of IDs that need to be linked starting from the last ID towards the first, creating a column for each ID in the chain. The chains may vary in length, as indicated by the question mark (?) for the last ID in the second row, signifying that the length of each chain can differ.
While I’m familiar with the basic functionalities of KNIME, the best nodes or combinations thereof to accomplish this specific task elude me. Has anyone tackled a similar challenge or could offer insights on how to proceed? I’m seeking advice on:

  • The methodology to invert the connection order for the IDs, beginning with the end of the chain.

  • Strategies to dynamically generate a new column for each ID in the chain, given the variability in their lengths.

Any recommendations, including the nodes to consider and their configuration, would be immensely appreciated. Thank you in advance for your guidance!

connect_ids.xlsx (8.7 KB)

Hi @maxi4040 ,

Thank you for your question and welcome to the forum!

I had fun trying to solve the problem. I ended up using two loops and got the desired output. Maybe someone else would be able to solve it with fewer nodes. I have attached the workflow I used to solve this. Let me know if you have any other questions.

KNIME_project.knwf (214.4 KB)

Final output :

Workflow :

Best,
Keerthan

1 Like

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