It’s World Statistics Day! To honor the theme of the day, the JMP User Community is having conversations about the importance of trust in statistics and data. And we want to hear from you! Tell us the steps you take to ensure that your data is trustworthy.
Choose Language Hide Translation Bar
Highlighted
john_madden
Level V

Hiding column group in JSL

In the manual interface, you can click on a column group and then hide/unhide all the columns in the group with a single click (or two/three clicks if the hidden state is mixed).

What is some simple JSL that accomplishes this same thing by script?

My attempts to script this all look squirrelly to me.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Hiding column group in JSL

Here is a script that works.  The current restriction is that it acts on the first group found, but that is an easy work around.

Names Default To Here( 1 );
dt = Current Data Table();

groupNames = dt << get column groups names;
group = dt << get column group( groupnames[1] ) << select;
For( i = 1, i <= N Items( group ), i++,
	dt:((dt << get selected columns)[i]) << hide( 1 )
);

Another community member may have a way to take the For() loop out of the code, but I was not able to find one.

Jim

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

Re: Hiding column group in JSL

Here is a script that works.  The current restriction is that it acts on the first group found, but that is an easy work around.

Names Default To Here( 1 );
dt = Current Data Table();

groupNames = dt << get column groups names;
group = dt << get column group( groupnames[1] ) << select;
For( i = 1, i <= N Items( group ), i++,
	dt:((dt << get selected columns)[i]) << hide( 1 )
);

Another community member may have a way to take the For() loop out of the code, but I was not able to find one.

Jim

View solution in original post

Highlighted
john_madden
Level V

Re: Hiding column group in JSL

Here's a complication: some of the columns in my groups derive from a virtual join. So when I perform a <<Get Column Group("groupname") on those particular groups, the list that results looks like this:

 

group = {:LocalColumnA, Referenced Column("ForeignColumnA", Referenced Column("ForeignColumnB", Reference(Column(:ForeignLinkReferenceColumnA), …}

and the group<<hide(1) action only succeeds on the local columns, not on the foreign (virtually joined) columns.

Yet when I do this in the manual interface, the virtually joined columns respond just fine to a manual Hide/Unhide menu selection.  Aaargh.

Article Labels

    There are no labels assigned to this post.