Send the Set Selected message to select a column.
col << Set Selected( 1 );
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
colList = dt << Get Column Names( String );
For( i = 1, i <= N Cols( dt ), i++,
If( Contains( colList[i], "NPN" ), // select only columns with NPN
// in the name
Column( colList[i] ) << Set Selected( 1 )
)
);
If you want to select many columns, consider sending the Select Columns message to the data table. See Close a Data Table.
To get a list of currently selected columns, use the Get Selected Columns message.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:age << Set Selected( 1 );
:sex << Set Selected( 1 );
dt << Get Selected Columns();
{:age, :sex}
Return the list of selected columns as a string using the "string" argument:
dt << Get Selected Columns( "string" );
{"age", "sex", "height"}
To actually select the columns before getting the columns, send the Set Selected message to a column. For more information, see Column Attributes.
To select and move to a specific column, use the Go To message.
dt << Go To( column name | column number );
dt = Open( "$SAMPLE_DATA/Tiretread.jmp" );
dt << Go To( 1 );
To select any column that is currently deselected and deselect any column that is currently selected, use the Invert Column Selection message.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:age << Set Selected( 1 );
dt:height << Set Selected( 1 );
Wait( 1 );
b = dt << Invert Column Selection;
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
a = {:height, :weight};
b = dt << Invert Column Selection( a );