Hi there @lcollia,
see this topic.
There you will find workflow example how to control variable number of columns in GroupBy node using flow variable type array/collection which is new from version 4.1. Probably you’ll need to modify wf example to your use case.
Br,
Ivan