- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to insert text in frames in fit curve platform with Group and By variables (JMP 18)
Hi all!
I want to insert a text in frames in the fit curve platform using a Group and a By variable via JSL (JMP 18).
Therefore I tried the following code, but it doesn't work:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
obj = dt << Fit Curve(Y(:weight), X(:height), Group(:sex), Fit Linear, By(:age));
robj = obj << report;
(robj << XPath(
"(//OutlineBox[text()='Fit Curve']//OutlineBox[text()='age=12']//OutlineBox[text()='Linear']//OutlineBox[text()='Plot']//FrameBox)[2]"
)) << Add Graphics Script( 1, Description( "Script" ), Text( {52, 120}, "F 12" ) );
I copied the XPath from the properties of the frame using Mode: XPath and Root: Window.
In JMP 17, this works with the following code:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
obj = dt << Fit Curve(Y(:weight), X(:height), Group(:sex), Fit Linear, By(:age));
robj = obj << report;
(robj << XPath( "(//OutlineBox[text()='Fit Curve age=12']//OutlineBox[text()='Linear']//OutlineBox[text()='Plot']//FrameBox)[2]" )) <<
Add Graphics Script( 1, Description( "Script" ), Text( {52, 120}, "F 12" ) );
The result should look like this for Fit curve age=12 (screenshot from JMP 17):
Many thanks for your help!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert text in frames in fit curve platform with Group and By variables (JMP 18)
I would most likely use the list of platforms you get and loop over that (unless you wish to have exactly same text for each of the frameboxes in same location, then I would maybe use XPath and top level of the report)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
fcs = dt << Fit Curve(Y(:weight), X(:height), Group(:sex), Fit Linear, By(:age));
reports = fcs << report;
For Each({cur_report}, reports,
//cur_report = reports[1];
Try(
cur_report[Outline Box("Linear"), OutlineBox("Plot"), FrameBox(2)] << Add Graphics Script(1,
Text({52, 120}, "F 12")
);
,
Write("\!NIssue with ", cur_report << get title, "\!N", exception_msg);
);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert text in frames in fit curve platform with Group and By variables (JMP 18)
Your example added same text to each of the frameboxes so I did the same (as in I didn't know what you wanted to add). Adding the graphic script will fail if the report doesn't have curves fit, for example there could be too few observations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert text in frames in fit curve platform with Group and By variables (JMP 18)
I would most likely use the list of platforms you get and loop over that (unless you wish to have exactly same text for each of the frameboxes in same location, then I would maybe use XPath and top level of the report)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
fcs = dt << Fit Curve(Y(:weight), X(:height), Group(:sex), Fit Linear, By(:age));
reports = fcs << report;
For Each({cur_report}, reports,
//cur_report = reports[1];
Try(
cur_report[Outline Box("Linear"), OutlineBox("Plot"), FrameBox(2)] << Add Graphics Script(1,
Text({52, 120}, "F 12")
);
,
Write("\!NIssue with ", cur_report << get title, "\!N", exception_msg);
);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert text in frames in fit curve platform with Group and By variables (JMP 18)
Hi jthi,
Many thanks for your reply. Please let me clarify my question:
Your script inserts "F12" in every framebox with data of females but I would need a specific text in every framebox with linear fits.
I think this can be realized by using "reports [1]", "reports [2]" etc. instead of "cur_report" and without the "For Each..." function.
Is there a reason, why you use "Try" and a potential error message instead of Eval? What could make the insertion of the Graphics Script fail?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert text in frames in fit curve platform with Group and By variables (JMP 18)
Your example added same text to each of the frameboxes so I did the same (as in I didn't know what you wanted to add). Adding the graphic script will fail if the report doesn't have curves fit, for example there could be too few observations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to insert text in frames in fit curve platform with Group and By variables (JMP 18)
Now I understand, thank you for the explanation and for your support!