Converting Column Data to Column Headers

I have a table that has one row per product, along with a set of attributes for that product. The problem is that some of the attributes are indicated by the attribute name in one column, and the corresponding attribute data in the next column. There are over 200 attributes, so manually doing it is not my preferred approach:

I tried playing around with unpivoting, trying to extract the column header and play around with that…but I am stuck.

Any ideas?

Have you tried the Transpose node either on its own or in conjunction with pivoting / row to header?

Hi @npatrick

I was thinking of something like this Converting Column Data to Column Headers.knwf (40.2 KB)

I assume the order of the columns is always Attribute_x_Name-Attribute_x_Value.
gr. Hans


Thanks @HansS, I ended up working out another solution, but I like yours better.
I ended up using a Transpose combined with a Row Filter to create a Dictionary table to combine with an Insert Column Header node:


Thanks @iCFO , mentioning the Transpose node got me thinking about creating a dictionary table to rewrite the column headers.

1 Like

Glad it helped. I find that the Transpose node often presents me a dynamic path to a solution when I am having a hard time wrapping my head around a transformation.

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