What I want is to append a new column, for which each row’s cell value will be a combination of the column names that have values. To illustrate, it’d look like something below:
Now, there are a few additional challenges:
I need to add a separator to the column names when combined, so that the output is “readable”. In the example, I used " + ";
I must avoid for instance simply adding a space in the combination for columns that have no data (so that in the case of Row3 I don’t end up with a double space at the beginning such as " NAME SURNAME C");
Finally, I have many columns (and their names/amount might change depending on my input file), so I’m thinking something using FlowVariables & loops so I have a scalable solution
Go column by column and with Column Expressions node replace values with header names or empty string. After that combine columns and a bit of string manipulation functions does the job. Did you do something similar?
Also if no secret what is the use case behind it? Already been similar requests (although not including Header names!) to loop over multiple columns and I got a feeling a smarter approach should be available…
Yes, I did something very similar, it just had a few extra steps due to the nature of my data.
Indeed I can’t get into too much detail, but essentially the case was that I had a list of stores, products and the products sales in those stores, and what I wanted to do was to segment those stores according to the portfolio that was sold.
So naturally I could have I very high number of potential portfolio combinations, depending of the total number of products and the maximum amount of products a store could handle. Even if we weren’t talking about the possible ones but the actual combinations seen, this number would be pretty high to try and do it by hand through some crazy =IF() rule in excel.
I can see this being used in similar such cases of wanting to ‘tag’ or cluster a set of observations according to a combination of factors.