cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

Passing outer variables into Add Graphics Script() in Graph Builder

I am encountering an issue while programming in JMP's JSL language. When I use the `Add Graphics Script()` function to customize a Graph Builder, outer-scope variables are not passed to the script as values at the time of addition, which leads to errors. I have tried using the `Eval()` function to convert variables into their values, but `Add Graphics Script()` passes the `Eval()` call itself into the Graph Builder, and the error persists. Is there a proper way to inject the current values of external variables into the script so that they are evaluated correctly within the Graph Builder context?

Names Default To Here( 1 );
rpt = Current Report();
cc = 1;
rpt[Frame Box( 1 )] << Add Graphics Script(
	1,
	Description( "" ),
	Text( Center Justified, {0, 0}, cc )
);

AggregateHare95_0-1781837815928.png

Name Unresolved: cc in access or evaluation of 'cc' , cc/*###*/

1 REPLY 1
jthi
Super User

Re: Passing outer variables into Add Graphics Script() in Graph Builder

You have to evaluate it inside the graphic script. Below is one option using EvalExpr (Substitute is also a good option).

Names Default To Here(1);

rpt = Current Report();

cc = 1;

Eval(Eval Expr(
	rpt[Frame Box(1)] << Add Graphics Script(
		1, 
		Description(""), 
		Text(Center Justified, {0, 0}, Expr(cc))
	)
));
-Jarmo

Recommended Articles