How to union columns by position

Hi, hope y’all are doing great!

I’ve just moved from Alteryx to Knime (already read the pdf Alteryx from Knime) and I can’t find a similar tool that Alteryx have.

In Alteryx you have the Union tool that made possible joining columns (similar to Concatenate in Knime) but this tool in Alteryx has an option of letting you combine the columns by position too. That means if I have the following columns…

Table 1 Headers
A - B - C - D

Table 2 Headers
E - F - G - H

And I combine this tables by matching headers, this will result in 8 columns but if I combine by position it should remain 4 columns with the EFGH data under the ABCD data. The 4 columns outcome is what I’m trying to achieve.

Thanks in advance!

1 Like

Hello @Le18BR and welcome to the KNIME forum.

KNIME doesn’t have the function required in your description, as concatenate requires equal column names plus format type. But say so, it’s quite easy to assign the column names from your first table to the second prior to the row binding of the two tables.

Insert Column Header’ node can do the job. There are few recent examples on how it works, in the last week challenge “Just Knime It” Challenge 15

I hope this helps, but please ask for any clarification if further help is needed.

BR

5 Likes

Hi @Le18BR and welcome to the KNIME community forum

If the operation you need to do is to concatenate “A with B”, “B with F” and so on by column position instead of by column name, this can be achieved by using first the -Extract Column Header- node in each of your tables and then -Concatenate- them and finally -GroupBy- them based on the initial row Index.
To achieve the -groupby- operation, you would need first to extract the Row Index using for instance the math node. All this should look as follows:

The other way round is as explained by @gonhaddock which is essentially the opposite way.

Hope it helps.

Best
Ael

4 Likes

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