- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
For option 2, what are these?
"¤"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use a variable with Outlinebox[ text()='text']
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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;