adding n columns after pivot

test.knwf (19.4 KB)

Dear all,

I am executing pivot node as shown in attached workflow.
Depending on datarows before pivoting I get more or less pivot colums as a result:
1 first(a)
1 first(b)
2 fist(a)
2 first(b)
3 first(a)
4 first(b)

I have to add several columns, so that there are always 20 sets, eg.

19 first(a)
19 first(b)
20 first(a)
20 first(b)

Is there an comfortable way to add these additonal columns when then do not exit; maybe with a loop.
Please see below pseudocode I have in mind:
for i = 1 to 20
if column i first(a) not exists
create colum i first(a)
create column i first(b)
endif
next i

Any idea?

Thanks for help!

BR,

Heinz

This is my take based on what I believe you’re looking for.
First Create the Matrix of all possibilities, then join actual results to the matrix. Have the matrix columns tag as “Right” so you can pick them out when filtering.

One quick note, if I were you I’d replace the keys table creator that with a group by of all unique keys from the actual section. So your matrix is dynamic to the actuals.

test.knwf (41.3 KB)

1 Like

Hi Nick_Rivera,

thank you very much for help!

BR,

Heinz

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