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
mvanderaa1
Level IV

How to find the reference to an object in a platform using the tree structure?

Hi, I've been trying to use references to objects in analysis platforms (graphs, tables, etc) in scripts, but in my opinion it's not very intuitive from the examples I've seen.

 

I have multiple use cases, but I'm hoping to find a generic description or manual on how to find the reference to any object in an analysis platform. I'm guessing it exists somewhere on this site but I have not been able to find it.

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to find the reference to an object in a platform using the tree structure?

In my opinion there is no generic solution for this as there are so many different platforms in JMP and some of them do behave differently than others. My general approach is to take a look at the XML with << Get XML and then use XPath (XPath is also nice as it works outside of JSL) with some combination of << sib, << child, <<parent.... If it is a very simple case then I might use report subscripting Scripting Guide > Display Trees > Navigate JMP Reports > Display Box Object References .

 

Below are some links:

-Jarmo

View solution in original post

9 REPLIES 9
jthi
Super User

Re: How to find the reference to an object in a platform using the tree structure?

In my opinion there is no generic solution for this as there are so many different platforms in JMP and some of them do behave differently than others. My general approach is to take a look at the XML with << Get XML and then use XPath (XPath is also nice as it works outside of JSL) with some combination of << sib, << child, <<parent.... If it is a very simple case then I might use report subscripting Scripting Guide > Display Trees > Navigate JMP Reports > Display Box Object References .

 

Below are some links:

-Jarmo
mvanderaa1
Level IV

Re: How to find the reference to an object in a platform using the tree structure?

Thanks, this is pretty much what I was looking for. I remember the "Steal this code" presentation but I also couldn't find it anymore.

 

I will accept this as a solution, although I still feel this subject deserves a more concise explanation on JMP learning and/or the scripting Index within JMP so that users know where to start.

mvanderaa1
Level IV

Re: How to find the reference to an object in a platform using the tree structure?

Looking at the XPath examples I realized many of my problems arise when I use a "group by" variable in the platform.

Taking the example I find in the XPath link:

 

This script works fine

 

// not grouped by sex
dt = Open(   "$SAMPLE_DATA\Big Class.jmp" );
ow = dt << Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 ),
	Mean of Means( 1 )
);

testXML = Report (ow) << Get XML;
Write( testXML );

/* Return a list of NumberColBox references */
ncbList = Report( ow )["Means and Std Deviations"] << XPath( "//NumberColBox" );

If I group by sex however, get XML already throws an error. How to handle this?

 

// group by sex
dt = Open(   "$SAMPLE_DATA\Big Class.jmp" );
ow = dt << Oneway(
	Y( :height ),
	X( :age ),
	By( :sex ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 ),
	Mean of Means( 1 )
);

// get XML fails for this platform
testXML = Report (ow) << Get XML;
Write( testXML );

/* Return a list of NumberColBox references */
ncbList = Report( ow )[???]["Means and Std Deviations"] << XPath( "//NumberColBox" );
Jeff_Perkinson
Community Manager Community Manager

Re: How to find the reference to an object in a platform using the tree structure?

When you use a By() you get the message returns a list of platforms, not a single platform.

 

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
ow = dt << Oneway(
	Y( :height ),
	X( :age ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 ),
	Mean of Means( 1 )
);

Show( ow );

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
ow_by = dt << Oneway(
	Y( :height ),
	X( :age ),
	By( :sex ),
	Means and Std Dev( 1 ),
	Mean Error Bars( 1 ),
	Std Dev Lines( 1 ),
	Mean of Means( 1 )
);

Show( ow_by );

Log:

/*:

ow = Oneway[];
ow_by = {Oneway[], Oneway[]};
-Jeff
jthi
Super User

Re: How to find the reference to an object in a platform using the tree structure?

You could try wrapping Oneway with New Window

Names Default To Here(1);

// group by sex
dt = Open("$SAMPLE_DATA\Big Class.jmp");
nw = New Window("", ow = dt << Oneway(Y(:height), X(:age), By(:sex), Means and Std Dev(1), Mean Error Bars(1), Std Dev Lines(1), Mean of Means(1)));

// get XML fails for this platform
testXML = nw << Get XML;
Write(testXML);

ncbList = nw << XPath("\[//OutlineBox[text()="Means and Std Deviations"]//NumberColBox]\");
-Jarmo
hogi
Level XII

Re: How to find the reference to an object in a platform using the tree structure?

As Jarmo indicated in his first reply, in JMP17 it got a bit easier now to get the correct XPath for an object:

Right click on the object, click on Show Properties (... adjust the selection if needed) and click on hogi_1-1667501045793.png in the Box Path menu on the right:

 

hogi_0-1667501023107.png

 

hogi
Level XII

Re: How to find the reference to an object in a platform using the tree structure?

another Trick:
Generate the XML code for the current report (not just the report of the object; think about data filters etc.)

 

I linked the code below to a Keyboard shortcut - and now I can get the XML code for any report that I want.

Just select the report and press (e.g.) CTRL - Alt + X

Local({myTitle= Current Report()<< get Window Title() || " - (xml)"},
New Window (myTitle ,<<Type( "Script" ),Current Report()<< Get XML))

Re: How to find the reference to an object in a platform using the tree structure?

There is also a utility function to help with determining the best path to a display box.

 

path.PNG

hogi
Level XII

Re: How to find the reference to an object in a platform using the tree structure?

 


as I have no access to JMP17. 

really?

I would have guessed that you get your special, personal, free JMP Pro signature editon the first day a new version comes out

... to support you as much as possible in supporting others