cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

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

How to reuse/move Graph Builder visuals from one table in another (after update via JSL)?

Hi everyone,

I’m working in JSL and have created several Graph Builder visualizations on Table A.
Later in the script, I update or join Table A with Table B (using Time as the key and ID as a filter) — this creates a new table (let’s call it Merged Table).

The issue is:

  • The visuals and Graph Builder setups I made on Table A don’t automatically appear in the Merged Table.

  • I want to copy or reapply those same visualizations to the new table that results from the join/update.

Pondering - 

  1. Is there a JSL-based way to transfer or rebind Graph Builder scripts from one table to another?

  2. What’s the most reliable workflow for this if certain KPIs are calculated only on filtered rows based on time windows?

I also tried the code below but I don't see mt calcTable showing that on the GUI window onTop Left panel. 

scriptNames = dt_merged << Get Table Script Names;
Show(scriptNames);

// Loop through and copy each script to calcTable
For(i = 1, i <= N Items(scriptNames), i++,
	scriptName = scriptNames[i];
	scriptCode = dt_merged << Get Table Script(scriptName);
	
	// Add the same script to calcTable
	calcTable << Set Table Script(scriptName, scriptCode);
	
	Show("Copied script:", scriptName);
);
1 REPLY 1
jthi
Super User

Re: How to reuse/move Graph Builder visuals from one table in another (after update via JSL)?

Usually it will look something like this to copy table scripts over but it might require modifications depending on how those table scripts look like

Names Default To Here(1);

dt1 = Open("$SAMPLE_DATA/Big Class.jmp");
dt2 = Open("$SAMPLE_DATA/Big Class Families.jmp");
dt2 << Delete Scripts(dt2 << Get Table Script Names); // demo purposes

For Each({scriptname}, dt1 << Get Table Script Names,
	s = dt1 << Get Script(scriptname);
	Eval(EvalExpr(
		dt2 << New Script(scriptname, Expr(NameExpr(s)))
	));
);

You can also use Concatenate because it will move scripts (and variables) over but it could possibly mess with something else, so I would use the loop

Names Default To Here(1);

dt1 = Open("$SAMPLE_DATA/Big Class.jmp");
dt2 = Open("$SAMPLE_DATA/Big Class Families.jmp");
dt2 << Delete Scripts(dt2 << Get Table Script Names); // demo purposes


dt_temp = dt1 << Subset(Rows(1), private);
dt_temp << Delete Rows(1);

dt2 << Concatenate(
	dt_temp,
	"Append to first table"
);
Close(dt_temp, no save);
-Jarmo

Recommended Articles