cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
john_madden
Level VI

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
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
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
john_madden
Level VI

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.