I have a Tabel whit a row for every Item that was bought. I need a to make it a Tabel whit a row for every customer that bought something and a column for every Item he/she bought.(with empty cells in the last columns if the customer is not the one buying the most items)
I already have a Loop doing that, but that is highly inefficient. I thought that in filter out all coustomers that bought 2 items. fiter out every uneven row and every even row and join them agian using the coustemer ID.
And if there is a way to filter out every third row I can use the same method again. For all custemers that bought more then 8 Items I can probably use the Loop I already have.
No, I want in the row for the customer that bought 7 Items to have the coustomer Id in the first column and in the following columns the item id for the Items he/she bought. And the same thing for the coustomer that bought 5 items but whit missing values in the last tow columns.
Why not use the "group by" node based on Customer ID and then both concatenate and count the number of items that were bought. You can subsequently use the cell splitter node to split out the individual items to separate columns.
@suppe
An example for the input and desired output would be helpful… When you need groupby, chances are you could also use (unpivot-apply)-pivot instead.
- group loop partitions the table by customer id and allows you to allocate a variable name (called "item name" in this workflow) to each item, the variable name depending on the row number within the group ;
- pivot then uses this variable name column to rotate the item rows per customer id into columns.