cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

Update table and keep grouped columns

rhakim23
Level I

Hello,

 

I have a JSL script where I'm updating a JMP table with data from a second table that has columns that are grouped. As it stands the update ungroups all the columns from the second table. I can't find anything in the interactive window to specify keeping it grouped, is this possible? Using JMP 17.2. Thanks!

2 REPLIES 2
WebDesignesCrow
Super User


Re: Update table and keep grouped columns

Hi @rhakim23 ,

Is it possible to share the mock data table to explain on what you are trying to do?

The JSL script can follow the similar logic afterwards.

Can Tabulate helps to re-group after update?

Or should you update second table from the 1st table?

WebDesignesCrow_0-1710153281901.png

 

jthi
Super User

Re: Update table and keep grouped columns

I think you might have to do this through scripting. Below is one example

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

dt2 = Open("$SAMPLE_DATA/Big Class Families.jmp");
// create a column groups
dt2 << Group Columns("Stats1", {:age, :sex});
dt2 << Group Columns("Stats2", {:height, :weight});
dt2 << Group Columns("Stats3", {:sports, :countries visited});


// Get groups from dt2
colgroups = dt2 << Get Column Groups Names;
groups = Associative Array();
For Each({groupname}, colgroups,
	groups[groupname] = dt2 << Get Column Group(groupname);
);

dt << Update(
	With(dt2),
	Match Columns(:name = :name)
);

Close(dt2, no save);

// add groups back
For Each({{groupname, groupcols}}, groups,
	dt << Group Columns(groupname, groupcols);
);
-Jarmo