cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
shampton82
Level VII

How to use a variable with Outlinebox[ text()='text']

Hey everyone,

I'm having an issue with some code.  

MinParam=(report << XPath("//OutlineBox[text()='min']//OutlineBox[text()=mindist]//StringColBox[StringColBoxHeader[text()='Parameter']]"))<<get;

Here the variable is "mindist" and it equals "Normal 2 Mixtures".  However, I can't get it to work.

 

Any suggestions?

 

Thanks!

 

Steve

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to use a variable with Outlinebox[ text()='text']

You could build it into the string

xpath_query = "//OutlineBox[text()='min']//OutlineBox[text()='" || mindist || "']//StringColBox[StringColBoxHeader[text()='Parameter']]";
MinParam = (report << XPath(xpath_query)) << get;

or maybe better is to use Eval Insert

xpath_query_template = "//OutlineBox[text()='min']//OutlineBox[text()='¤mindist¤']//StringColBox[StringColBoxHeader[text()='Parameter']]";
xpath_query = Eval Insert(xpath_query_template, "¤");
MinParam = (report << XPath(xpath_query)) << get;
-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: How to use a variable with Outlinebox[ text()='text']

You could build it into the string

xpath_query = "//OutlineBox[text()='min']//OutlineBox[text()='" || mindist || "']//StringColBox[StringColBoxHeader[text()='Parameter']]";
MinParam = (report << XPath(xpath_query)) << get;

or maybe better is to use Eval Insert

xpath_query_template = "//OutlineBox[text()='min']//OutlineBox[text()='¤mindist¤']//StringColBox[StringColBoxHeader[text()='Parameter']]";
xpath_query = Eval Insert(xpath_query_template, "¤");
MinParam = (report << XPath(xpath_query)) << get;
-Jarmo
shampton82
Level VII

Re: How to use a variable with Outlinebox[ text()='text']

Thanks @jthi !

That works!  I also realized that the name is different for the 3 mixtures in that it adds distribution to the end so that was probably the real issue but now I have more options to use.

shampton82_1-1732819150344.png

 

 

For option 2, what are these? 

"¤"

 

hogi
Level XII

Re: How to use a variable with Outlinebox[ text()='text']

hogi_0-1732821171323.png

jthi
Super User

Re: How to use a variable with Outlinebox[ text()='text']

I use "non-default" starting/ending characters (used to indicate in which place the to be replaced variable is) as ^ appears too often in text (mostly it messes with anything using Regex). Eval Insert(string, <startDel>, <endDel>, < <<Use Locale(1) >) .

 

You can also use contains instead of text. Syntax is something like this (there is also starts-with in XPath and many more)

Report(dist) << XPath("//OutlineBox[contains(text(), 'Fitted Normal 3 Mixture')]//StringColBox[StringColBoxHeader[text()='Parameter']]");

If you need access to just single Fitted Normal 3 Mixture Distribution and string col box under it, it might be easier to use report subscripting instead of XPath. It also supports wild cards, but it is much more limited than XPath on what you can do (it is still useful from time to time), Get References to Display Box Objects Create a Reference by Subscripting / Wildcard String

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Cytometry.jmp");
dist = dt << Distribution(Column(:CD8));
dist << Fit Normal 3 Mixture;


scb = Report(dist)[OutlineBox("Fitted Normal ? Mixture ?"), StringColBox("Parameter")];
scb << get;

 

-Jarmo