turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- JSL - Creating a loop for custom distribution repo...

Topic Options

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

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

Jun 2, 2016 7:24 AM
(1484 views)

Hello,

is there a way to create a place holder variable via array that can be substituted into the distribution report layer syntax? The code I have just loops the distribution giving me 10 windows with 10 graphs each with no frame adjustments. I want 1 window with 10 graphs that have had the frame size adjusted.

**My Code**

/*Run Analyte Array*/

analyteArr = Associative Array**(**:Analyte**)** << **Get Keys**;

For**(** eachAnalyte = **1**, eachAnalyte <= N Items**(** analyteArr **)**, eachAnalyte++,

/*Slope Distribution*/

Current Data Table **(**dtmain**)**;

dtmain << **Distribution(**

Automatic Recalc**(** **1** **)**,

SendToByGroup**(** **{**:Analyte == analyteArr**[**eachAnalyte**]}** **)**,

SendToByGroup**(**

**{**:Analyte == analyteArr**[**eachAnalyte**]}**,

Continuous Distribution**(** Column**(** :Slope **)**, Vertical**(** **0** **)** **)**

**)**,

By**(** :Analyte **)**,

SendToByGroup**(**

**{**:Analyte == analyteArr**[**eachAnalyte**]}**,

SendToReport**(**

Dispatch**(**

**{**"Distributions Analyte=" || analyteArr**[**eachAnalyte**]**, "Slope"**}**,

"Distrib Outlier Box",

FrameBox,

**{**Frame Size**(** **550**, **50** **)}**

**)**,

Dispatch**(**

**{**"Distributions Analyte=" || analyteArr**[**eachAnalyte**]**, "Slope"**}**,

"Distrib Histogram",

FrameBox,

**{**Frame Size**(** **550**, **325** **)}**

**)**

**)**

**)**

**)**

**)**;

1 ACCEPTED SOLUTION

Accepted Solutions

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

Jun 2, 2016 8:26 AM
(1450 views)

Solution

Here is your script modified to place all of the distributions into a single window. I am not clear as to what you mean by "frame size adjusted". Could you please clarify that? Is it that you want all of the results shrunk down so they all fit within your display screen?

**// Create a display window and place the distributions in it**

** **

**New Window( "All Together", **

**// layout the distributions side by side**

** **

** H List Box(**

** **

**/*Run Analyte Array*/**

** **

** analyteArr = Associative Array( :Analyte ) << Get Keys;**

** **

** For( eachAnalyte = 1, eachAnalyte <= N Items( analyteArr ), eachAnalyte++, **

** **

**/*Slope Distribution*/**

** Current Data Table( dtmain );**

** **

** dtmain << Distribution(**

** Automatic Recalc( 1 ),**

** SendToByGroup( {:Analyte == analyteArr[eachAnalyte]} ),**

** SendToByGroup(**

** {:Analyte == analyteArr[eachAnalyte]},**

** Continuous Distribution( Column( :Slope ), Vertical( 0 ) )**

** ),**

** By( :Analyte ),**

** SendToByGroup(**

** {:Analyte == analyteArr[eachAnalyte]},**

** SendToReport(**

** Dispatch(**

** {"Distributions Analyte=" || analyteArr[eachAnalyte], "Slope"},**

** "Distrib Outlier Box",**

** FrameBox,**

** {Frame Size( 550, 50 )}**

** ),**

** Dispatch(**

** {"Distributions Analyte=" || analyteArr[eachAnalyte], "Slope"},**

** "Distrib Histogram",**

** FrameBox,**

** {Frame Size( 550, 325 )}**

** )**

** )**

** )**

** );**

** );**

** )**

**);**

Jim

5 REPLIES

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

Jun 2, 2016 8:26 AM
(1451 views)

Here is your script modified to place all of the distributions into a single window. I am not clear as to what you mean by "frame size adjusted". Could you please clarify that? Is it that you want all of the results shrunk down so they all fit within your display screen?

**// Create a display window and place the distributions in it**

** **

**New Window( "All Together", **

**// layout the distributions side by side**

** **

** H List Box(**

** **

**/*Run Analyte Array*/**

** **

** analyteArr = Associative Array( :Analyte ) << Get Keys;**

** **

** For( eachAnalyte = 1, eachAnalyte <= N Items( analyteArr ), eachAnalyte++, **

** **

**/*Slope Distribution*/**

** Current Data Table( dtmain );**

** **

** dtmain << Distribution(**

** Automatic Recalc( 1 ),**

** SendToByGroup( {:Analyte == analyteArr[eachAnalyte]} ),**

** SendToByGroup(**

** {:Analyte == analyteArr[eachAnalyte]},**

** Continuous Distribution( Column( :Slope ), Vertical( 0 ) )**

** ),**

** By( :Analyte ),**

** SendToByGroup(**

** {:Analyte == analyteArr[eachAnalyte]},**

** SendToReport(**

** Dispatch(**

** {"Distributions Analyte=" || analyteArr[eachAnalyte], "Slope"},**

** "Distrib Outlier Box",**

** FrameBox,**

** {Frame Size( 550, 50 )}**

** ),**

** Dispatch(**

** {"Distributions Analyte=" || analyteArr[eachAnalyte], "Slope"},**

** "Distrib Histogram",**

** FrameBox,**

** {Frame Size( 550, 325 )}**

** )**

** )**

** )**

** );**

** );**

** )**

**);**

Jim

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

Jun 2, 2016 9:55 AM
(1329 views)

Thank you Jim,

That certainly stops the 10 windows from popping up.

As far as frame size adjuesments, I'm speaking about the part of the code that dictates the frame sizes should be 550, 50 and 550, 325 respectively. Currently, despite having the array variable listed, I'm still getting the default frame sizes of 227, 46 and 277, 110.

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

Jun 2, 2016 10:24 AM
(1329 views)

The issue is, that you are attempting to change items within a list, and JMP looks at lists and says that a list is just a bunch of stuff, so it isn't going to touch it. So the method I use to build the lists to the form I want them is to use the Substitute function, and then when I have the list the way I want it, I have JMP evaluate what I have built. I can not be sure the code below is exactly what you need, but it should be close. to test out that the Substitute is working correctly, just run eliminate the "Eval" function that surrounds the Substitute command and just run the Substitute command by itself, and it will show the results in the log......

**//Create a display window and place the distributions in it**

** **

**New Window(**

** "All Together", **

**// layout the distributions side by side**

** **

** H List Box(**

** **

**/*Run Analyte Array*/**

** **

** analyteArr = Associative Array( :Analyte ) << Get Keys;**

** **

** For( eachAnalyte = 1, eachAnalyte <= N Items( analyteArr ), eachAnalyte++, **

** **

**/*Slope Distribution*/**

** Current Data Table( dtmain );**

** Eval(**

** Substitute(**

** Expr(**

** dtmain << Distribution(**

** Automatic Recalc( 1 ),**

** SendToByGroup( {__by__} ),**

** SendToByGroup(**

** {__by__},**

** Continuous Distribution( Column( :Slope ), Vertical( 0 ) )**

** ),**

** By( :Analyte ),**

** SendToByGroup(**

** {__by__},**

** SendToReport(**

** Dispatch(**

** {__Dist__, "Slope"},**

** "Distrib Outlier Box",**

** FrameBox,**

** {Frame Size( 550, 50 )}**

** ),**

** Dispatch(**

** {__Dist__, "Slope"},**

** "Distrib Histogram",**

** FrameBox,**

** {Frame Size( 550, 325 )}**

** )**

** )**

** )**

** );**

** ),Expr(__by__),Parse(":Analyte ==" char(eval( analyteArr[eachAnalyte]))),**

** Expr(__Dist__),"Distributions Analyte=" || char(eval(analyteArr[eachAnalyte])))**

** )**

** );**

** )**

**);**

Jim

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

Jun 2, 2016 11:21 AM
(1329 views)

Thank you for the help with this,

This seems to adjust the first of my by variables but not the rest. I think there must be something wrong with the way I'm looping. Not only does it only adjust the first of my by variables, but I just noticed that in the single window I have 100 graphs rather than just the 10 I expected (the 10 x 10 I was getting just all in one window).

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

Jun 2, 2016 1:08 PM
(1329 views)

You appear to be both looping, and also using By Grouping.....that maybe what can account for your 10x number of graphs

Jim