Combine values from 4 columns into 1 column (times 2 sets in one table) resulting with only 2 merged columns

Hello there, hope everyone is doing well and healthy.

I’m trying to “unpivot??” a table that seems like a prime-use-case for KNIME but am having difficult time doing so. I tried unpivoting as well. I have looked around the forum and there are many posts and am trying to incorporate but I haven’t been able to do so successfully. I have attached a data set I’m using here. I do want to retain the order for date and index value.

If you could point me to the right direction, I would greately appreciate it. Thank you so much in advance for your help.

KNIME_project test 123.knwf (8.8 KB)

image

image

hi @alabamian2,

please find the attached workflow, which should help you get week and index values side by side. Basically it filters the column pair for each year and renames the columns at the end of each loop step. You simply need a table with all the year values.
At the end, you get a long list of Week and Index values.

split column pairs and concatenate.knwf (21.4 KB)

Hope that helps, br, Tommy

3 Likes

Hi @tommy,
Thank you so much for jumping in quickly to share the solution. I tested it and it is awesome. I’d never thought of this…I’m going to study and really understand it so that I can repurpose in other use cases. Thank you so much again for your support.

Hope you have a nice evening. Thank you.

2 Likes

hhmm, I’m trying to incorporate this into my workflow and am getting the error “WARN WorkflowManager Unable to merge flow object stacks: Conflicting FlowObjects: <Loop Context (Head 4:3, Tail unassigned)> - iteration 0 vs. <Loop Context (Head 4:4013, Tail unassigned)> - iteration 0 (loops/scopes not properly nested?)”

Do I need to put the output of Node 4018 Constant Value Column in a temporary table or temp Excel file and have the Column Filter with error ingest that file/table? Here is the updated workflow with data. KNIME_project test 123 version2.knwf (84.6 KB)

I’m going to try out a few things. Thank you.

hi @alabamian2 ,

encapsulating/nesting two Table Row to Variable Loop Start is complicated, so I would suggest to end the first loop before starting the second. However you run your approach by using a metanode, please find the workflow attached.

KNIME_project test 123 version2.knwf (84.3 KB)
Besides you would need to check your join after the metanode, matching row ids. For this you might configure the loop end in the metanode…

Hope that helps, br,
Tommy

3 Likes

Hello @tommy ,
Yes!! I have incorporated it into the workflow and it’s working beautifully and nicely. I’ve read in other posts suggesting to “wrap” and I now know what that meant…Metanode!! I learned a use case of Metanode and thank you so very much for educating me with an example.

Thank you so much @tommy and hope you have a wonderful weekend.

1 Like

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