BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Highlighted
pcarroll1

Community Trekker

Joined:

Aug 11, 2016

Unpredictable Orthogonal Fit Display Window Title

I am making a series of Orthogonal Fit plots using a jsl script and I need to send a message to each one (I want the default to close the analysis result box). However, the title of that box is unpredictable because it contains the ratio value, the format of which varies depending upon the order of magnitude of the value. Some examples are shown below. Orthogonal Fit Ratio=0.000 Orthogonal Fit Ratio=0.123 Orthogonal Fit Ratio=1.234 Orthogonal Fit Ratio=12.34 Orthogonal Fit Ratio=1234 Orthogonal Fit Ratio=12345 Orthogonal Fit Ratio=1e+6 How do I write code to address any one of these potential eventualities? The easy solution would be if I could close all analysis boxes that start with Orthogonal.
1 ACCEPTED SOLUTION

Accepted Solutions
ih

Community Trekker

Joined:

Sep 30, 2016

Solution

Re: Unpredictable Orthogonal Fit Display Window Title

Change the last line to search for outline boxes with the correct helpKey:

 

Names Default To Here( 1 );

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

// create container for platform references
platform = List();

dt << New Column( "agenum", formula( Num( :age ) ) );

// launch platform
p = dt << Fit Group(
	Bivariate( Y( :weight ), X( :height ), Fit Orthogonal( Univariate Variances, {Line Color( {213, 72, 87} )} ) ),
	Bivariate( Y( :weight ), X( :agenum ), Fit Orthogonal( Univariate Variances, {Line Color( {213, 72, 87} )} ) ),
	<<{Arrange in Rows( 2 )}
);

// save reference in the list
Insert Into( platform, p );
Wait( 1 );

// send message to all platforms
( platform << XPath("//OutlineBox[@helpKey='Bivar Ortho']") ) << Close( 1 );
4 REPLIES 4
ih

Community Trekker

Joined:

Sep 30, 2016

Re: Unpredictable Orthogonal Fit Display Window Title

I would use XPath, maybe this will get you started:

Names default to here( 1);

dt = Open( "$Sample_data/iris.jmp" );

win = New Window( "Bivariate Fits",
	dt << Bivariate(
		Y( :Sepal length ),
		X( :Sepal width ),
		Fit Orthogonal( Univariate Variances, {Line Color( {213, 72, 87} )} )
	),
	dt << Bivariate(
		Y( :Petal length ),
		X( :Petal width ),
		Fit Orthogonal( Univariate Variances, {Line Color( {213, 72, 87} )} )
	)
);

( win << XPath("//OutlineBox[@helpKey='Bivar Ortho']") ) << Close( 1 );
( win << XPath("//OutlineBox[@helpKey='Bivar Ortho']") )[1] << Close( 0 );

//Here is how I found the helpKey:
win << Show tree structure
markbailey

Staff

Joined:

Jun 23, 2011

Re: Unpredictable Orthogonal Fit Display Window Title

You can also save the reference to the windows when they launch and then send a message to them. If you store the references in a list, then the list will distribute the message to all the items. See this example:

Names Default to Here( 1 );

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

// create container for platform references
platform = List();

// launch first platform
p = dt << Distribution( Y( :weight, :height ) );
// save reference in the list
Insert Into( platform, p );
Wait( 1 );

// launch second platform
p = dt << Bivariate( Y( :weight ), X( :height ), Fit Line );
// save reference in the list
Insert Into( platform, p );
Wait( 1 );

// send message to all platforms
platform << Close Window;
Learn it once, use it forever!
pcarroll1

Community Trekker

Joined:

Aug 11, 2016

Re: Unpredictable Orthogonal Fit Display Window Title

Thanks. What I actually want to do is illustrated below. The last line won't work but the idea is to close the Analysis Box, not the actual plots. I can normally do this for most analysis boxes (Fit Line, etc...) but Orthogonal Fit has a special problem because a result of the analysis is actually incorporated in the name of the box.

Pat


Names Default to Here( 1 );

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

// create container for platform references
platform = List();

dt << New Column("agenum", formula(Num(:age)));

// launch platform
p = dt << Fit Group(
Bivariate(
Y( :weight ),
X( :height ),
Fit Orthogonal( Univariate Variances, {Line Color( {213, 72, 87} )} )
),
Bivariate(
Y( :weight ),
X( :agenum ),
Fit Orthogonal( Univariate Variances, {Line Color( {213, 72, 87} )} )
),
<<{Arrange in Rows( 2 )}
);

// save reference in the list
Insert Into( platform, p );
Wait( 1 );

// send message to all platforms

platform << Dispatch( {}, "Orthogonal Fit Ratio=?", OutlineBox, {Close( 1 )} );


ih

Community Trekker

Joined:

Sep 30, 2016

Solution

Re: Unpredictable Orthogonal Fit Display Window Title

Change the last line to search for outline boxes with the correct helpKey:

 

Names Default To Here( 1 );

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

// create container for platform references
platform = List();

dt << New Column( "agenum", formula( Num( :age ) ) );

// launch platform
p = dt << Fit Group(
	Bivariate( Y( :weight ), X( :height ), Fit Orthogonal( Univariate Variances, {Line Color( {213, 72, 87} )} ) ),
	Bivariate( Y( :weight ), X( :agenum ), Fit Orthogonal( Univariate Variances, {Line Color( {213, 72, 87} )} ) ),
	<<{Arrange in Rows( 2 )}
);

// save reference in the list
Insert Into( platform, p );
Wait( 1 );

// send message to all platforms
( platform << XPath("//OutlineBox[@helpKey='Bivar Ortho']") ) << Close( 1 );