BookmarkSubscribeRSS Feed
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

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
mpb
Super User mpb
Super User

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
0 Kudos
14 REPLIES 14
mpb
Super User mpb
Super User

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
0 Kudos

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
0 Kudos
mpb
Super User mpb
Super User

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
0 Kudos

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
0 Kudos
mpb
Super User mpb
Super User

Re: JSL: Group columns

dt << group columns("Pulses")
0 Kudos
chungwei
Staff

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"
0 Kudos
mpb
Super User mpb
Super User

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
0 Kudos
chungwei
Staff

Re: JSL: Group columns

I think this will do it

datatable("Fitness 3D") << group columns("test", {:RunPulse, :MaxPulse});
0 Kudos
mpb
Super User mpb
Super User

Re: JSL: Group columns

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