Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 29, 2012 8:21 PM
(8349 views)

I'm trying to use JSL to draw horizontal lines in multiple frameboxes of an overlay plot report containing a "by" grouping. The desired y-intercept of the horizontal line varies from one framebox to the next. This seems easy to do with some loops and the "add graphics script" command however the horizontal lines always appear at the same location in every frame box. For example if the report has 5 frameboxes and the y-intercept list contains 5 different values, all 5 frameboxes will display the line at yintercept[5] because they all contain the exact same script: "HLine(yintercept*);" and 5 was the last value of i. Any ideas on how to assign a unique script to each framebox?*

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I was able to solve this dilemma after doing some reading in the JMP 9 scripting guide. The key is to make use of the substitute function. My original code looked something like this:

**for (i=1,i<=nBy,i++, //loop through each of the by groups in the report**

** r [Frame Box(1)] << Add Graphics Script(2, HLine(HT));**

** );**

After incorportating the substitute function it looks like this:

**for (i=1,i<=nBy,i++, //loop through each of the by groups in the report**

** eval(substitute(**

** expr(r [Frame Box(1)] << Add Graphics Script(2, HLine(HT);**

** )),expr(i),i);**

** );**

** );**

So now when I review the script associated with each framebox I see HLine(HT[1]), HLine(HT[2])... instead of HLine(HT*)*

3 REPLIES 3

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I was able to solve this dilemma after doing some reading in the JMP 9 scripting guide. The key is to make use of the substitute function. My original code looked something like this:

**for (i=1,i<=nBy,i++, //loop through each of the by groups in the report**

** r [Frame Box(1)] << Add Graphics Script(2, HLine(HT));**

** );**

After incorportating the substitute function it looks like this:

**for (i=1,i<=nBy,i++, //loop through each of the by groups in the report**

** eval(substitute(**

** expr(r [Frame Box(1)] << Add Graphics Script(2, HLine(HT);**

** )),expr(i),i);**

** );**

** );**

So now when I review the script associated with each framebox I see HLine(HT[1]), HLine(HT[2])... instead of HLine(HT*)*

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: graphics scripting dilemma in a report with multiple frameboxes

Hello again,

unfortunately i wasn´t able to solve the issue of adding different graphics scripts to multiple frameboxes with the above solution.

Here is my script:

```
for (i=1,i<=nBy,i++, //loop through each of the by groups in the report
minLine = Eval( Eval List(dPATMin[i]) );
maxLine = Eval( Eval List(dPATMax[i]) );
eval(
substitute(
expr(
rep[Frame Box(i)] << Add Graphics Script(
2,
H Line( minLine );
H Line( maxLine );
);
)
,
expr(i)
,
i
);
);
);
```

Does anyone has a solution for adding different "H Lines" to multiple FrameBoxes?

Thanks!

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: graphics scripting dilemma in a report with multiple frameboxes

Maybe sometimes you have to talk about it...

Here is what made the trick for me:

```
for (i=1,i<=nBy,i++, //loop through each of the by groups in the report
minLine = Eval( Eval List(dPATMin[i]) );
maxLine = Eval( Eval List(dPATMax[i]) );
eval(
Eval Expr(
rep[Frame Box(i)] << Add Graphics Script(
2,
H Line( Expr(minLine) );
H Line( Expr(maxLine) );
);
)
);
);
```

Article Labels

There are no labels assigned to this post.