cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
rhakim23
Level I

Update table and keep grouped columns

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

Recommended Articles