Hi all,
I have a datatable with multiple columns, some of which I want to add together. As a part of my script, I am selecting some of the columns, storing the column names in a list and then hoping to add the selected columns using the "Sum" feature.
In order to do that I need to build a string ":DATA1, :DATA2, :DATA3" and Parse it in a column.
New Column( "Addition", Numeric, Continuous, Formula( Parse( Sum( :DATA1, :DATA2, :DATA3 ) ) ) );
A snippet of the code I am using is below:
New Column( "Addition", Numeric, Continuous, Formula( Parse( Sum( :DATA1, :DATA2, :DATA3 ) ) ) );
list = {"DATA1", "DATA2", "DATA3"};
For( i = 1, i <= N Items( list ), i++,
If(
i == 1, string = ":" || Char( Eval( list[Eval( i )] ) ),
i > 1, string = string || "," || ":" || Char( Eval( list[Eval( i )] ) )
)
);
Parse( string );
On execution, I get the following error:
Unexpected ",". Perhaps there is a missing ";" or ",".
Line 1 Column 7: :DATA1►,:DATA2,:DATA3
The remaining text that was ignored was
,:DATA2,:DATA3
:DATA1
Is there anything I am missing?
Thanks in advance!