Calculate / modify column based on another column values (which name is unknown before runtime)

Hi guys,

Simply put, I have following table, where DYN_X columns are dynamically created during project execution, based on key value pairs from some parameters:

Col 1 | Col 2 | Col 3 | Col 4 | DYN_1 | DYN_2
1 | 2 | 3 | 4 | Col 1 | Col 3
2 | 2 | A | 4 | Col 1 | Col 3

DYN_1 and DYN_2 values indicate me I should get their values respectively from Col 1 and Col 2. Thus, I would like to process the table above to get the follwing result:

Col 1 | Col 2 | Col 3 | Col 4 | DYN_1 | DYN_2
1 | 2 | 3 | 4 | 1 | 3
2 | 2 | A | 4 | 2 | A

The complexity (for me :-)) is that I do not know prior to project runtime how many DYN columns will be created.... I do not think it is possible to use a dynamically created column name in expression editor, and so far, I cannot find a solution with an undefine number of DYN columns, as I reach dead ends with the different iterations actions I tried to use.

Any ideas are welcome, thanks a lot.

This should do it :slight_smile: :

Calculate or modify column based on another column values.morph (5.9 KB)

1 Like

Super helpful. Thanks @Jochen_Marquardt !
Looks like I am too often looking for complex solutions where smarter ones exist.

1 Like