Minimum formula breaks with concatenation of stringsHi,
I want to create a for loop that does 2 things:
1. creates new columns based on the indices of the for loop (this works as it creates min_val0 and min_val1 columns)
2. make a formula (minimum function) for each newly created column that will take present columns based on indices of the for loop (does not work)
It seems that trying to concatenate "val0_ " and char(i) inside the formula and minimum function is breaking. Is there any other work around for this? This is a small example but in my case I have hundreds of columns that would need to this type of code.
Code:
for(i = 0, i <= 1, i += 1,
new column("min_val" || char(i), formula(minimum(("val0_" || char(i)), :Name("val1_0"),:Name("val2_0"))))
)

ScriptingRe: Minimum formula breaks with concatenation of stringsWhen you define a formula, it will not do any calculations during it's definition. So one has to provide to the formula, all of the JSL required. Below is one method for the creation of the columns and formulas you want
For( i = 0, i <= 1, i += 1,
Eval(
Substitute(
Expr(
New Column( "min_val" || Char( i ),
formula(
Minimum( (__minval__), :Name( "val1_0" ), :Name( "val2_0" ) )
)
)
),
Expr( __minval__ ), Parse( "val0_" || Char( i ) )
)
)
);