"Graph Builder" adds On Colse() function, exception when encryption runsJMP community expert, I'm from China.
The following problem description comes from machine translation. Please don't mind that the grammar can be a little strange.
I am encountering some issues with a potential bug in the JMP17 script. I would appreciate it if you could seek assistance from the experts to address this matter.
I have created a script for "Graph Builder". In order to automatically close the referenced data table when the Graph Builder is closed, I have added the following script using On Close():
gb << On Close( Close( gb << Get Data Table, nosave ) );
But since I have a lot of data tables and need to generate graphs simultaneously through the for() loop, I optimized the following script:
Eval( Eval Expr( Expr( gb ) << On Close( Close( Expr( gb ) << Get Data Table, nosave ) ) ) );
However, an unexpected issue arose. While there were no problems running the script normally, when I encrypted and ran it, an exception was reported upon closing the graph, which has left me quite perplexed.

The following is a complete test script. Your help in analyzing this problem would be greatly appreciated.
Names Default To Here( 1 );
fileList = {"big class.jmp", "Big Class Families.jmp"};
For Each( {file, i}, fileList,
dt = Open( Eval Insert( "$sample_data/^file^" ), "invisible" );
gb = dt << Graph Builder(
Size( 917, 645 ),
Variables( X( :sex ), Y( :height ) ),
Elements(
Points( X, Y, Legend( 5 ) ),
Box Plot( X, Y, Legend( 6 ) ),
Caption Box( X, Y, Legend( 9 ), Summary Statistic( "Mean" ), Location( "Graph per factor" ), X Position( "Left" ) )
),
SendToReport(
Dispatch( {}, "Points", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Box Plot", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Caption Box", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Caption Box", Outline Box( 2 ), {Close( 1 )} )
)
);
Eval( Eval Expr( Expr( gb ) << On Close( Close( Expr( gb ) << Get Data Table, nosave ) ) ) );
);
Automation and ScriptingWindowsRe: "Graph Builder" adds On Colse() function, exception when encryption runsI have replicated your On Close error with an encrypted script. I believe it is a JMP bug and I suggest that you submit the issue to JMP Support.
support@jmp.com
Re: "Graph Builder" adds On Colse() function, exception when encryption runsI'm not sure where it goes wrong when the script is encrypted, but this seems to work (I modified the on close and expression evaluation for it)
Names Default To Here(1);
fileList = {"big class.jmp", "Big Class Families.jmp"};
For Each( {file, i}, fileList,
dt = Open(Eval Insert("$sample_data/^file^"), "invisible");
gb = dt << Graph Builder(
Size(917, 645),
Variables(X(:sex), Y(:height)),
Elements(
Points(X, Y, Legend(5)),
Box Plot(X, Y, Legend(6)),
Caption Box(
X,
Y,
Legend(9),
Summary Statistic("Mean"),
Location("Graph per factor"),
X Position("Left")
)
),
SendToReport(
Dispatch({}, "Points", OutlineBox, {Close(1)}),
Dispatch({}, "Box Plot", OutlineBox, {Close(1)}),
Dispatch({}, "Caption Box", OutlineBox, {Close(1)}),
Dispatch({}, "Caption Box", Outline Box(2), {Close(1)})
)
);
Eval(EvalExpr(
gb << On Close(
Close(Expr(dt), nosave);
);
));
);
Re: "Graph Builder" adds On Colse() function, exception when encryption runsThank you, Jarmo. This is indeed a good method.
I use "gb << On Close(Close(gb << Get Data Table, nosave))" It is to bind gb and dt, but I seem to forget that they are originally bound.
While it should be syntactically correct, this could indeed be an internal error in a JSL script. I'll take @txnelson 's advice and refer this issue to JMP Support.
Re: "Graph Builder" adds On Colse() function, exception when encryption runsThank you, Jim.
This could really be a JSL Bug, as Jarmo doesn't seem to be able to explain the cause of this error either. I will accept your suggestion to submit it to JMP Support.
In addition, Jarmo shares a clever way to get around this problem that we can learn together.