Subscribe Bookmark RSS Feed

Subset of columns selected in a Col List Box

hacketkm

Community Trekker

Joined:

Sep 14, 2012


I would like to make a subset with the columns that a user chooses from a Col List Box. I have used the Col List Box example from the Scripting Guide but I don't know how to use the values of Chosen Columns = { "col1", "col2", "col3" } as column names to create a subset. Can anyone help me out?

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Subset() appears to resolve a list of column names as in the example below (the conditional if() should not be necessary but JMP 10 crash for me if trying to do a subset with an empty list, i.e. if no columns was selected).

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Window( "Select columns",

  lb = Col List Box( all ),

  Button Box( "make subset",

  If( N Items( lb << get selected ) >= 1,

  dt << subset( columns( lb << get selected ) )

  )

  )

);

2 REPLIES
Solution

Subset() appears to resolve a list of column names as in the example below (the conditional if() should not be necessary but JMP 10 crash for me if trying to do a subset with an empty list, i.e. if no columns was selected).

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Window( "Select columns",

  lb = Col List Box( all ),

  Button Box( "make subset",

  If( N Items( lb << get selected ) >= 1,

  dt << subset( columns( lb << get selected ) )

  )

  )

);

hacketkm

Community Trekker

Joined:

Sep 14, 2012

Thank you! I am able to make this method work for my script.