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
tom_abramov
Level V

All OutlineBoxes with title condition By XPath

Hello,

I would like to add Page Break to All Oneway OutlineBoxes in my Journal.

Sort Of

(jrn << XPath("//OutlineBox[contains(./title(), 'Oneway Analysis')]")) << Prepend (Page Break Box());

What is the right expression?

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: All OutlineBoxes with title condition By XPath

I think "//OutlineBox[@helpKey='Oneway Report']" is what you are looking for:

 

Names default to here( 1 );

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

(ow1 = ( dt << Oneway( Y( :Sepal length ), X( :Species ) ) ) ) << Journal;
(ow2 = ( dt << Oneway( Y( :Sepal width ), X( :Species ) ) ) ) << Journal;
(ow3 = ( dt << Oneway( Y( :Petal length ), X( :Species ) ) ) ) << Journal;
(ow4 = ( dt << Oneway( Y( :Petal width ), X( :Species ) ) ) ) << Journal;

{ ow1, ow2, ow3, ow4 } << Close Window;

//By text:
( Current Journal() << XPath("//OutlineBox[contains( text(), 'Oneway')]") ) << Prepend (Page Break Box());

//By helpkey (better):
( Current Journal() << XPath("//OutlineBox[@helpKey='Oneway Report']") ) << Prepend ( Page Break Box() );

 

 

Edited to use the helpkey attribute (more robust than title), thank you Justin for the links.

View solution in original post

5 REPLIES 5
ih
Super User (Alumni) ih
Super User (Alumni)

Re: All OutlineBoxes with title condition By XPath

I think "//OutlineBox[@helpKey='Oneway Report']" is what you are looking for:

 

Names default to here( 1 );

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

(ow1 = ( dt << Oneway( Y( :Sepal length ), X( :Species ) ) ) ) << Journal;
(ow2 = ( dt << Oneway( Y( :Sepal width ), X( :Species ) ) ) ) << Journal;
(ow3 = ( dt << Oneway( Y( :Petal length ), X( :Species ) ) ) ) << Journal;
(ow4 = ( dt << Oneway( Y( :Petal width ), X( :Species ) ) ) ) << Journal;

{ ow1, ow2, ow3, ow4 } << Close Window;

//By text:
( Current Journal() << XPath("//OutlineBox[contains( text(), 'Oneway')]") ) << Prepend (Page Break Box());

//By helpkey (better):
( Current Journal() << XPath("//OutlineBox[@helpKey='Oneway Report']") ) << Prepend ( Page Break Box() );

 

 

Edited to use the helpkey attribute (more robust than title), thank you Justin for the links.

tom_abramov
Level V

Re: All OutlineBoxes with title condition By XPath

Thank you.

Is there some documentation/tutorial/book with Xpath rules and syntax in JMP?

ian_jmp
Level X

Re: All OutlineBoxes with title condition By XPath

If you've not seen it, take a look at the Discovery Paper by @Phil_Brown

tom_abramov
Level V

Re: All OutlineBoxes with title condition By XPath

Thank you.

Re: All OutlineBoxes with title condition By XPath

I would recommend checking out W3School's documentation on XPath for information about specific XPath syntax.

I typically tackle XPath problems by looking at the display tree's underlying XML by sending the Get XML() message to the report layer. Showing the XML in the log, I can see all of the attributes available, even ones that you cannot see by just looking at a report, like the helpKey or charID, which can be helpful for identifying the display objects you need. You can copy the XML into something like xpathtester.com or just use the XML within the XPath Query() JSL function to test out your query, without needing the report to be created.

Justin