BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
tom_abramov
Community Trekker

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.

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
ih
ih
Community Trekker

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.

5 REPLIES 5
ih
ih
Community Trekker

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
Community Trekker

Re: All OutlineBoxes with title condition By XPath

Thank you.

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

0 Kudos
ian_jmp
Staff

Re: All OutlineBoxes with title condition By XPath

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

Highlighted
tom_abramov
Community Trekker

Re: All OutlineBoxes with title condition By XPath

Thank you.
0 Kudos

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