cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Connor_K
Level II

Option to Treat Distribution() as Modal

Hi,

 

Is it possible to treat the "Distribution" function as modal? I am looking to create a distribution report with an arbitrary number of Continuous Distributions that I will later modify or change via JSL. I found that a dialog opens when I run the code below, but execution is not halted and the rest of my code is run before I have a chance to select my columns of interest. 

I have also looked into using a Column Dialog, but cannot figure out how to directly code a distribution report object with an arbitrary number of Continuous Distributions. Any input on how to accomplish this is greatly appreciated!

 

 

dist = dt << Distribution( Stack ( 1 ), <<Modal );

 

vs putting something like below in a for loop...

Distribution(
Stack( 1 ),
Continuous Distribution(
Column( As Column( arbitraryName ) ),
Horizontal Layout( 1 )
Vertical( 0 ),
),
);

 

Many thanks,

Connor

 

Using JMP 16.0.0

Connor
3 REPLIES 3
txnelson
Super User

Re: Option to Treat Distribution() as Modal

Here is one way to do this.  Just put the distribution into a modal window.  

Names Default To Here( 1 );

dt = 
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );


new window("",modal,
Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( As Column( "weight" ) ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),

	)
));

txnelson_0-1690321738438.png

No code past the window execution will be run until the OK button is pressed.

 

Jim
Connor_K
Level II

Re: Option to Treat Distribution() as Modal

Jim, thanks for the response. I think my question could have used some more clarification, but I found a way to do what I wanted shown below. It is however a bit clunky...

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );

dlg = Column Dialog( colList = Col List( "Columns" ), );
numCols = N Items( dlg["colList"] );

startSubstring = ",Continuous Distribution( Column(:";
endSubstring = "), Horizontal Layout( 1 ), )";
mainStr = "Distribution( Stack( 1 )";

For( colCount = 1, colCount <= numCols, colCount++,
	myCol = dlg["colList"][colCount];
	distStr = startSubstring || Expr( myCol ) || endSubstring;
	mainStr ||= distStr;
	Show( mainStr );
);
mainStr ||= ")";
dist = Eval( Parse( mainStr ) );

// Code to modify dist goes here

This is basically a less efficient Distribution dialog, but resolves the issue I was having before of execution not halting when I ask a user to select their columns. This is all done with the intention of appending statistics to the resulting distribution window. Thanks for your help!

Connor
jthi
Super User

Re: Option to Treat Distribution() as Modal

Most likely using modal window like Jim suggested is the easiest option.

 

You can also provide expressions to platforms which will be run after user completes the selections, but using this is usually more difficult and not necessary Scripting Guide > Scripting Platforms > Enable User Input in JMP Platforms 

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt << Distribution(Action(doit));

doit = Expr(
	New Window("Bivariate", Bivariate(Action(doit2)))
);

doit2 = Expr(Caption("analyses complete"));
-Jarmo