cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar

JSL: How do I Group Columns with JSL?

Hello community:

One can group columns by selecting them in the columns window and choosing "Group columns" in the context menu. Is there a JSL statement doing the same thing? I found nothing in the operators index or scripting guide.

Thanks,
Dahla

1 ACCEPTED SOLUTION

Accepted Solutions
mpb
mpb
Level VII

Re: JSL: Group columns

Here's an example of how to do Group Columns in a script.

dt = current data table();
//Following Expects Fitness Table to be Current;
column("RunPulse") << Set Selected(1);
column("RstPulse") << Set Selected(1);
column("MaxPulse") << Set Selected(1);

dt << group columns();

Michael

View solution in original post

14 REPLIES 14
mpb
mpb
Level VII

Re: JSL: Group columns

Here's an example of how to do Group Columns in a script.

dt = current data table();
//Following Expects Fitness Table to be Current;
column("RunPulse") << Set Selected(1);
column("RstPulse") << Set Selected(1);
column("MaxPulse") << Set Selected(1);

dt << group columns();

Michael

Re: JSL: Group columns

Thanks for the solution, Michael!

One additional question: How do you know the "group columns()" statement? I wonder if one can find a complete overview of jsl statements somewhere?

Dahla
mpb
mpb
Level VII

Re: JSL: Group columns

I guessed. The JSL messages corresponding to menu items tend to be the same as the equivalent menu item text. The JMP Scripting Guide (Help>Books>JMP Scripting Guide) contains a pretty complete list of JSL statements and basic usage. I think "group columns" just was overlooked when the most current edition was made. I suppose there is an outside possibility that it was undocumented because it's not thoroughly tested. If you are worried about that possibility you may want to query JMP support to verify it's safe to use (in JSL) in the current 8.0.1 version.

Michael

Re: JSL: Group columns

Thanks again, although this is not the answer I hoped for. ;)
Do you have another guess for the right command to set the title of a column group?

Dahla
mpb
mpb
Level VII

Re: JSL: Group columns

dt << group columns("Pulses")
chungwei
Staff (Retired)

Re: JSL: Group columns

This statement

data table("Fitness") << group columns("test", :Runtime, 4);

will put 4 columns, starting with Runtime, into a group, and name the group "test".

Alternatively,

data table("Fitness") << group columns("AAA", :Runtime :: :MaxPulse);

will group Runtime thru MaxPulse and name the group "AAA"
mpb
mpb
Level VII

Re: JSL: Group columns

Thanks for a more complete illustration of the "group columns" syntax. Do you know if there is an extension of it that allows grouping non contiguous columns, e.g. in the Fitness table just RunPulse and MaxPulse? If that cannot be done directly then the Selects followed by the simpler group columns does permit it which is the only advantage to it I can see. The syntax you illustrate is more compact and direct.

Michael
chungwei
Staff (Retired)

Re: JSL: Group columns

I think this will do it

datatable("Fitness 3D") << group columns("test", {:RunPulse, :MaxPulse});
mpb
mpb
Level VII

Re: JSL: Group columns

Ah, a *List* of column names...It surely does work! Thanks ChungWei.