Aligning Data based on the header name

Hello to all,

I need help to get the next result:

I have some options fake that have an specific character based on its header. This header normally is repeated. I would like to align characters based on the header name as shown in the following images:
Table:

X0A X0B X0A X0A X0B
FAKE1 A100
FAKE2 A101
FAKE3 A102
FAKE4 A103
FAKE5 A104

I want to get:

X0A X0B
FAKE1 A100
FAKE2 A101
FAKE3 A102
FAKE4 A103
FAKE5 A104

Hope anyone can help me.

Thanks,

Hi @plati , the input data you presented is impossible in Knime. You cannot have repeated/duplicate headers.

The Knime tables follow the same principles of a DB table where you cannot have multiple columns/fields with the same name.

Values are referenced by the column name, so the column names have to be unique.

Thanks bruno for the advice.

What about if we can do the following table:

Row1 Row2 Row3 Row4 Row5
X0A X0B X0A X0A X0B
FAKE1 A100
FAKE2 A101
FAKE3 A102
FAKE4 A103
FAKE5 A104

and get:

Row1 Row2
X0A X0B
FAKE1 A100
FAKE2 A101
FAKE3 A102
FAKE4 A103
FAKE5 A104

Do you think is possible making the row with duplicates not the columns name?

Thanks,

Hi @plati , so it would depend on the values of the first row? It makes things definitely more complicated for sure.

Also, now I’m not guaranteed that the first row would have a record in all the columns, as opposed to if there was a header, Knime would make sure there is a header even if there was not one, so there should be an additional check for this now.

Probably a Transpose and a Group By and Transpose back could work, I’d have to try it to see (I don’t have time at the moment to build a workflow unfortunately).

1 Like

Hi @plati , you can try unpivoting, then do string manipulation and then pivot it back (when the column names are same)

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