I've written a fairly complex JSL application using the JMP Application Builder. The application launcher prompts the user for column selections and then I sort the data by the chosen columns before continuing with processing and visualizations.
If the data set has dependent open windows, I need to give the user the option to continue without sorting (the data was likely pre-sorted) or exit the script to let the user deal with the dependent windows. To this end, I've created the following function:
sortThisData = Function ({dt},
try( dt << Sort (By( Column(snCol), Column(dtCol)), Replace Table) ,
/* IF thrown */
if (contains(exception_msg[1], "JMP cannot replace the existing table"),
ex = New Window( "Alert", <<Modal, <<Return Result,
V List Box( H List Box( "Set this value",
fontobj = text = Text Box( "JMP cannot replace the existing data table because open report windows depend on the previous ordering." )),
Text Box(""),
//H List Box( Button Box( "Continue Without Sorting" ), Button Box( "Cancel Script" ), Button Box("Create New Sorted Data Table") ) )
V List Box (rb = Radio Box( {"Continue Without Sorting",
"Cancel Script",
"Create New Sorted Data Table"} ) );
)
);
if (ex["rb"] == 1, /*Continue without sorting*/,
ex["rb"] == 2, /*Stop script*/ (thisModuleInstance << Get Box) << Close Window; stop(),
ex["rb"] == 3, /* New data table */ dt = Sort (By(Column(snCol), Column(dtCol)), invisible)
)
)
);
return (dt);
);
However, it seems that the application itself counts as a dependent open window! I can't sort the data even if no other windows are open.
How can I circumvent this issue and sort my data? I have moved the timing of calling my SORT function, but it needs to happen after the OK button on the launcher was pressed and before the processing/visualizations are done.
Any suggestions?