Script Run SequentiallyI am trying to create my Save Estimates from my survival platform, then grab the estimates in the newly created table. The problem is that it will not wait until the Survival table is created before executing the Output expression. I have tried finish, wait, different orders, etc... and I cannot get this to work, any suggestions? I have JMP 16.0 with MacBook.
Names Default To Here( 0 );
Clear Log();
dt = Current Data Table();
If( Not( Is Scriptable( dt ) ),
dtsel = Pick File( "Open File", {"JMP|jmp", "All files|*"} );
If( dtsel == "",
Stop(),
Try( dt = Open( dtsel ), Stop() )
);
);
Sur = Expr(
Obj = dt << Survival(
Failure Plot( 1 ),
Show Points( 1 ),
Show Shaded Simultaneous CI( 1 ),
Show Simultaneous CI( 1 ),
Weibull Fit( 1 )
//Save Estimates
);
dtname = Data Table( dt ) << Get Name;
Show( dtname );
obj << Save Estimates;
wait(1);
);
Eval( Survival );
Output = Expr(
dt2 = Data Table( dtname || " Survival");
columnnamegroup = Column( dt2, 1 ) << Get Name;
Groups = Column( dt2, columnnamegroup ) << Get As Matrix;
Show( Groups );
);
Eval(Output);AnalyticsmacOSScriptingRe: Script Run SequentiallyAre you getting any error message in JMP's log? In the example you gave have Sur name for expression and then evaluate Survival, not sure, could that be the issue? It should result in error like: Name Unresolved: Survival in access or evaluation of 'Survival' , Survival/*###*/
This seems to work fine after changing then Eval(Survivor) -> Eval(Sur):
Names Default To Here(0);
dt = Open("$SAMPLE_DATA/Rats.jmp");
Sur = Expr(
obj = dt << Survival(Y(:days), Censor(:Censor), Grouping(:Group));
dtname = Data Table(dt) << Get Name;
obj << Save Estimates;
);
Eval(Sur);
Output = Expr(
dt2 = Data Table(dtname || " Survival");
columnnamegroup = Column(dt2, 1) << Get Name;
Groups = Column(dt2, columnnamegroup) << Get As Matrix;
Show(Groups);
);
Eval(Output);
In the fairly rare cases JMP requires adding some delay, wait(0) is usually enough (and if you have lots of formulas << run formulas might help).
Re: Script Run SequentiallyI think I understand what you're trying to do -- effectively you want the input window for the Survival() platform to be Modal -- you want it to block execution of the script until the window is closed. You can do that by explicitly defining a window instead of relying on the default behavior. Here I've created a modal window that contains the input fields, then I grab each input and create the Survival() expression with the correct inputs.
Names Default To Here( 1 );
dt = Current Data Table();
If( Not( Is Scriptable( dt ) ),
dtsel = Pick File( "Open File", {"JMP|jmp", "All files|*"} );
If( dtsel == "",
Stop(),
Try( dt = Open( dtsel ), Stop() )
);
);
dtname = Data Table( dt ) << Get Name;
validated = 0;
New Window( "Inputs",
<<MODAL></MODAL>