I only want to execute on the columns that actually turned up and not fail because of the missing ones. I ultimately need a script that has some forgiveness for differences in the SQL query, as many operators need to use it and differences happen. One advantage I have is that the Transpose Column (:VALUE) and the Label column (:PARAMETER) have fixed titles, I dug into this a bit with some help form the information I found here and elsewhere, I got the script below which seems to work.
Solved: remove elements in a list - JMP User Community
Thanks for the help.
dt = Current Data Table();
// List available columns
by_col_names = dt << get column names( "String" );
show(by_col_names);
// Remove Transpose and Label columns from list
delcols = {"VALUE", "PARAMETER"};
For( i = 1, i <= N Items( delcols ), i++,
Remove From( by_col_names, As List( Loc(by_col_names, delcols[i] ) ) );
);
// Transpose only if valid columns exist
If (N Items(by_col_names) > 0,
dt2 = dt << Transpose(
Columns(:VALUE),
By(
by_col_names
),
Label( :PARAMETER ),
Output Table( "Transpose of dt_data" )
);
);
Slán
SpannerHead