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

- JMP User Community
- :
- Discussions
- :
- Stuck on Modal

- 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

Sep 5, 2019 12:37 AM
(2768 views)

Hello All,

i was hoping that someone can help me with Modal, previously i was calculating FV in my JMP script as follows:

```
Finalivc2 << New Column( "Runs", Numeric, Continuous );
:Runs<<set each value(2);
Finalivc2 << New Column( "Replicates per Run", Numeric, Continuous);
:Replicates per run<<set each value(1);
Finalivc2 << New Column( "Format Variability %GCV", Numeric, Continuous, Formula( ((2^root(((:IR)/(:Runs)+(:Residual)/(:Replicates per Run*:Runs)),2))-1)*100 ), Format( "fixed dec", 4, 1 ) );
```

which worked OK, although on ocassions i would forget to update the :Runs and :Replicates per run parameters which gave me some grief, i decided to automate this process using modal as follows

```
FV_param = New Window ("Format Variability Parameters", << Modal, << Return Result,
Text Box ("Select Format Variability Parameters"),//Create the display box
HListBox(
LineupBox (NCol (2),
Text Box ("Runs NOT REPLICATES"), Runs = numberEditBox(2),
Text Box ("Replicates NOT RUNS"), Replicates per Run = numberEditBox(1),
), // end of lineupbox
LineupBox ( NCol (1), ButtonBox ("OK"), ButtonBox ("Cancel"))
) // end HListBox
);
show (FV_param, FV_param ["Runs"], FV_param ["Replicates per Run"],
FV_param ["Button"] );
If (FV_param ["Button"] == -1,
Caption (" Wait...Aborting..."); Wait (3) ; Caption(Remove); Throw());
StatusMsg ("Processing next steps");
RemoveFrom (FV_param, NItems(FV_param)); // Removes the last item "Button 1" from the assignment list
Eval List(FV_param); // the assignment from the display box
Eval(
Substitute(
Expr( Finalivc2 = New Column( "Runs", Numeric, "Continuous", Format( "Best", 12 ),
Expr( Finalivc2 = New Column( "Replicates per Run", Numeric, "Continuous", Format( "Best", 12 ),
)
),
Expr( __FV_param__ ), Runs, Replicates per Run
)
)));
Finalivc2 << New Column( "Format Variability %GCV", Numeric, Continuous, Formula( ((2^root(((:IR)/(:Runs)+(:Residual)/(:Replicates per Run*:Runs)),2))-1)*100 ), Format( "fixed dec", 4, 1 ) );
```

i have no doubt i am doing the evaluating and substituting incorrectly, i am not getting the variables runs and Relicates per run in the table, and its then not doing the calculation, can anyone please offer some help

Thanks

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'm not sure where the journal is coming from or why it would say that. I run your code, with a dt open, and I get this:

I think @pmroz answer is not returning the values through the <<ReturnResult but rather through global variables. Your JSL is using the EvalList(FV_Param) to move the returned answers to the same global variables.

Is your table being created with the columns and values now? Maybe there is another issue after that.

Craige

9 REPLIES 9

Highlighted
##

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

Re: Stuck on Modal

the last bit of your script should look something like this. You may also run into some naming issues with JSL variable names and column names that are the same; using dt:Runs or global:Runs may help get the right one.

```
dt=currentDataTable(); // you should already have a variable for your data table
dt<<New Column( "Replicates per Run", Numeric, "Continuous", Format( "Best", 12 ), <<setEachValue( Replicates per Run ) );
dt<<New Column( "Runs", Numeric, "Continuous", Format( "Best", 12 ), <<setEachValue( Runs ) );
dt<<New Column( "Format Variability %GCV",
Numeric,
Continuous,
Formula( ((2 ^ Root( ((:IR) / (:Runs) + (:Residual) / (:Replicates per Run * :Runs)), 2 )) - 1) * 100 ),
Format( "fixed dec", 4, 1 )
);
```

Craige

Highlighted
##

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

Re: Stuck on Modal

Hi Craige,

have run out of time today but will try this in the morning and let you know, the problem i was having was evalusting and substituting the values from the dialogue boxes to the equation.

thanks

Highlighted
##

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

Re: Stuck on Modal

Hi Craige,

Had some time so tried to run the script with your suggestion, still didnt run, get the same error in debug, not enough arguments in access of evaluation of sustitute.

Regards

Mickyboy

Highlighted
##

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

Re: Stuck on Modal

Created:
Sep 6, 2019 4:15 AM
| Last Modified: Sep 6, 2019 7:16 AM
(2708 views)
| Posted in reply to message from Mickyboy 09-06-2019

(What version of JMP are you running? I'm on 14...)

You don't need to use substitute(...). Try replacing your *eval( ... substitute(... (expr(...* code with something like

`dt<<New Column( "Runs", Numeric, "Continuous", Format( "Best", 12 ), <<setEachValue( Runs ) );`

In your example, the parenthesis nesting has left substitute(eval(...)) with a single argument to substitute. Substitute needs (edit two->three) three arguments.

Craige

Highlighted
##

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

Re: Stuck on Modal

Hi Craige,

l am running the same version 14, so now my code looks like this

```
FV_param = New Window ("Format Variability Parameters", << Modal, << Return Result,
Text Box ("Select Format Variability Parameters"),//Create the display box
HListBox(
LineupBox (NCol (2),
Text Box ("Runs NOT REPLICATES"), Runs = numberEditBox(2),
Text Box ("Replicates NOT RUNS"), Replicates per Run = numberEditBox(1),
), // end of lineupbox
LineupBox ( NCol (1), ButtonBox ("OK"), ButtonBox ("Cancel"))
) // end HListBox
);
show (FV_param, FV_param ["Runs"], FV_param ["Replicates per Run"],
FV_param ["Button"] );
If (FV_param ["Button"] == -1,
Caption (" Wait...Aborting..."); Wait (3) ; Caption(Remove); Throw());
StatusMsg ("Processing next steps");
RemoveFrom (FV_param, NItems(FV_param)); // Removes the last item "Button 1" from the assignment list
Eval List(FV_param); // the assignment from the display box
dt<<New Column( "Runs", Numeric, "Continuous", Format( "Best", 12 ), <<setEachValue( Runs ) );
dt<<New Column ( "Replicates per Run", Numeric, "Continuous", Format( "Best", 12 ), <<setEachValue( Replicates per Run ) );
```

but it still wont set the valuse to what was input into the modal boxes, i get this in the Journal:

Format Variability %GCV

.

.

.

.

.

.

.

.

.

No values are posted in the Journals.

Any ideas??

Thanks for your help

Highlighted
##

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

Re: Stuck on Modal

You are trying to use the number edit box variables as values that were entered. You can't do that; instead you need to extract the values from the number edit boxes using **<< get**. In the code below I've appended **_neb** to the variables:

```
FV_param = New Window( "Format Variability Parameters",
<<Modal,
<<Return Result,
Text Box( "Select Format Variability Parameters" ), //Create the display box
H List Box(
Lineup Box( N Col( 2 ),
Text Box( "Runs NOT REPLICATES" ),
Runs_neb = Number Edit Box( 2 ),
Text Box( "Replicates NOT RUNS" ),
Replicates per Run_neb = Number Edit Box( 1 ),
), // end of lineupbox
Lineup Box( N Col( 1 ),
Button Box( "OK",
runs = runs_neb << get;
replicates per run = replicates per run_neb << get;
),
Button Box( "Cancel" ) )
) // end HListBox
);
```

Highlighted

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

I'm not sure where the journal is coming from or why it would say that. I run your code, with a dt open, and I get this:

I think @pmroz answer is not returning the values through the <<ReturnResult but rather through global variables. Your JSL is using the EvalList(FV_Param) to move the returned answers to the same global variables.

Is your table being created with the columns and values now? Maybe there is another issue after that.

Craige

Highlighted
##

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

Re: Stuck on Modal

Hi Graige,

Your solution from yesterday was correct, i miss coded, i used

dt<< new column instead of finalivc2<<new column and now it works perfectly

Runs | Replicates per Run | Format Variability %GCV |

2 | 1 | 26.1 |

2 | 1 | 25.9 |

2 | 1 | 29 |

2 | 1 | 28.4 |

2 | 1 | 29 |

2 | 1 | 29.6 |

2 | 1 | 28.4 |

2 | 1 | 28.4 |

2 | 1 | 20.7 |

My sincere apologies, it works great, thanks very much for your patience and help, it is greatly appreciated.

Sincere Regards

Mickyboy

Highlighted
##

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

Re: Stuck on Modal

Hi pmroz,

Thanks very much for your reply, i accepted Craige post from yesteday as the solution, i had miss coded from yesterday.

Regards,

Mickyboy.

Article Labels

There are no labels assigned to this post.