I've created a variable that is a string of column names. This is inside a FOR loop so it will change with each loop.
Here is a sample table for demonstration, in reality my table is about 400 columns with weird names. I'm trying to group columns that should be grouped and report the max value. 99.9% of the time there will only be 1 value per row for each 'like' column that is to be grouped.
Col1 | Col2 | Col3 |
22 | | |
| 22 | |
| | 32 |
| 32 | |
1 | | |
| | 56 |
| 34 | |
This first part is a loop that generates a variable column list. I don't have all the code here but here is a summary. This works so I don't want to bog down the discussion in this.
VarCols = functional code here and the output is a string with this format: {"col1", "col2", "col3"}
Then my code is supposed to create a new column named 'VarName' (defined in another part of the loop) then insert a formula that reports the max value of whichever columns are in VarCols. But I just can't get it to evaluate. Am I doing this way wrong?
DT << New Column(VarName, Numeric, "Continuous", formula(Maximum(columns(eval(VarCols)))));
Here is the specific error though i inserted the variable column name to avoid confusion:
Column VarName Formula Interrupted
Name Unresolved: columns 1 times At rows: 2 Operation: columns, columns( Eval( VarCols) ) /*###*/
Formula evaluation errors have been ignored