Subscribe Bookmark RSS Feed

JSL: Group columns

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
14 REPLIES
mpb

Super User

Joined:

Jun 23, 2011

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

Super User

Joined:

Jun 23, 2011

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

Super User

Joined:

Jun 23, 2011

dt << group columns("Pulses")
chungwei

Staff

Joined:

Jun 23, 2011

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

Super User

Joined:

Jun 23, 2011

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

Joined:

Jun 23, 2011

I think this will do it

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

Super User

Joined:

Jun 23, 2011

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