cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
marie_gaudard
Level III

How to prevent Run in Fit Model from producing a report?

I am writing a script that does the following:

 

  1. Opens a Fit Model window,
  2. Allows the user to populate it using the Macros and other functionality in the Fit Model window,
  3. Allows the user to click Run, at which point a possibly time-intensive calculation is performed and a report is produced.

 

The calculation that is performed when Run is clicked is produced by a script stored in the Run button.  This script produces a report, which is what the user should see.  However, because the script is added to the Run button, that desired report appears, but is then followed by the Fit Least Squares report that Run produces on its own.  The Fit Least Squares report is meaningless to the user. 

 

The script below illustrates the problem. In that script, the expression in the Run button, "runExpr", simply creates a clone data table; this is to simplify the illustration.  In the actual script, that expression (runExpr) performs a lot of analysis based on the effects entered in the Fit Model window. Also, in the actual script, the user populates the Fit Model window interactively; I populated the Fit Model window in the script below for convenience.

 

Names Default To Here( 1 );

runExpr = Expr(
// Creates a clone data table for illustration;
	dt << Subset( Output Table( "Clone Table" ), All rows );
);
	
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
fmSLS = Fit Model(
	Y( :weight ),
	Effects( :age, :height, :age * :height ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" ),
);

r = fmSLS << Report;
r[Button Box( 9 )] << Set Script( runExpr);

When you click Run, as a user would, the clone table appears, but the window on top is the Fit Least Squares report produced by the Run command.  I would like to prevent that report from appearing. 

 

To that end:

 

  • I have tried using Throw() and Stop() in runExpr, but to no avail. 
  • I considered using a modal window, but I need the Macro functionality in the Fit Model window, and I can't see how to make a modal window help.
  • The only way I can think of even to address the Fit Least Squares report is to add a timing loop to the script as illustrated below. But this is fraught with peril.  There is no way to know how long it will take for the runExpr to complete, and if the user decides not to click Run, the script just keeps running until it times out.

 

Any thoughts or help would be greatly appreciated! 

 

Names Default To Here( 1 );

runExpr = Expr(
// Creates a clone data table for illustration;
	dt << Subset( Output Table( "Clone Table" ), All rows );
	fm_Flag = 1
);
	
fm_Flag = 0;  // Sets flag for timing
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
fmSLS = Fit Model(
	Y( :weight ),
	Effects( :age, :height, :age * :height ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" ),
);
r = fmSLS << Report;

r[Button Box( 9 )] << Set Script( runExpr; fm_Flag = 1 );

For( i = 1, i <= 100, i++,
If(fm_Flag < 1, Wait(0.5), windowsopen = Get Window List(); windowsopen[nItems(windowsopen)] << Close Window; Stop() )
  );
10 REPLIES 10
marie_gaudard
Level III

Re: How to prevent Run in Fit Model from producing a report?

Mark, you raise a very good question and you make a good point.  Maybe there is a better way to get achieve my goal.  Please see my reply to "ih" above.  I need the Fit Model window simply because of its flexibility in allowing users to construct effects. The script that I am writing uses those effects to construct models using fractional bootstrap weights.  (Anyway, there are more details in the Reply to "ih" above.) 

 

I know that there are scripting functions that help construct model effects, but one would really need to replicate a lot of the functionality that exists in the Fit Model window.  I wish that one could use that window for effect construction without having to fit a model!