I am trying to create a list with all column names and turning some of them into a variable.
That variable should be going into an if-statement but I am struggling with the "name unresolved" error.
I'm guessing that JMP cannot find my previously defined variable but I do not know how to fix it even though I'm sure it should be quite simple.
dt = Current Data Table();
ColumnList = dt << Get Column Names(String);
A = ColumnList[40];
If(Contains(A, "test"),
var = :A[dt << get rows where( :column == value)];);<BR />// I cannot seem to get it to take the column saved in A
I would also like to know how I could potentially use the text of that variable in defining a column name.
dt << New Column( "[A] at 45km/h");
Thanks in advance!
You need to use As Column() function, and restructure the name on the new column a bit
dt =
// Open Data Table: big class.jmp
// → Data Table( "big class" )
Open( "$SAMPLE_DATA/big class.jmp" );
ColumnList = dt << Get Column Names( String );
value = 60;
A = ColumnList[4];
If( Contains( A, "hei" ),
var = As Column( A )[dt << get rows where( As Column( a ) == value )]
);
dt << New Column( "[" || A || "] at 45km/h");