cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

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

JSL: How to get retrieve names of more than one currently selected tables?

Hi folks. I'm dealing with new tables every day (unique table names) which always have at least one common column header, which I use to Match Columns for Join. This is getting repetitive so I've been thinking of writing a script.

 

Problem: I don't want to have to specify both the table names in the script every time I want to Join two tables.

 

I'm looking for a method for the script to auto/semi-automatically pick the two tables I want to join. I know there is a method to retrieve the Currently Selected table, but what about the table Selected Before That? Best case is if there is a method to retrieve table names for all tables currently selected and then proceed to do Join for these tables.

 

Appreciate all ideas and advice! Thanks!

 

 

1 REPLY 1
ian_jmp
Level X

Re: JSL: How to get retrieve names of more than one currently selected tables?

Of course there is only one 'current' table in a JMP session. But you could do something like this:

NamesDefaultToHere(1);

// Make some tables with different numbers of columns
n = 5;
for(t=1, t<=n, t++, NewTable("Table "||Char(t), << addMultipleColumns("Test", Random Integer(5), Character)));

// Function that returns the names of all open tables containing a specified column
tablesWithColumn =
Function({inCol}, {Default Local},
	matchingTables = {};
	for(t=1, t<=NTable(), t++,
		cols = DataTable(t) << getColumnNames("String");
		if(Contains(cols, inCol), InsertInto(matchingTables, DataTable(t) << getName));
	);
	matchingTables;
	);

// Try it out
myCol = "Test 3";
NewWindow("Open Tables with Column "||myCol, 
	PanelBox("Pick Tables to Join", 
		lb = ListBox(tablesWithColumn(myCol), maxSelected(2));		
		)
	);

Recommended Articles