cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
RVhydrA
Level III

delay code until application is completed

I have a script in which I am first asking a yes/no question in a dialogue box, if the use marks "yes", then a section of code will run that pulls data from a database which is then used to build an application. In that app the user interacts with the data (table and plots) to produce a pdf form, finalize those materials, close the application, and then move on to the next station at which time you get the same yes/no question but for a different location. The problem is that if I select yes, the code runs and creates the application (all great), but then continues on to the next dialogue box. Once that dialogue box pops up I cannot interact with my application. How can I code this so that the next dialogue doesn't come up until I am finished with my application?

 

Event=dialog("Are there samples at Site A?",
Vlist(Lineup(1,eventtype=radio buttons("Yes","No"),)));

If(Event["eventtype"] == 1,(

 

 //if the user selects yes then within here the code for this site runs to produce an application with graphs and tables (see example below). User must select points in the graph, generate pdf form, and then close the application before moving on.

 

);
);

 

 

In this screenshot you can see a button that says "finish up." I don't want my next dialogue box to pop up until after this has been clicked. 

RVhydrA_0-1726761392044.png

 

Running JMP 16.2.0

5 REPLIES 5
jthi
Super User

Re: delay code until application is completed

You can for example add the expression to create the next dialogue box inside the finish up button

-Jarmo
RVhydrA
Level III

Re: delay code until application is completed

Thats a good idea, but I've been messing around with the code and can't figure out how to get that to work. When I put the dialogue box inside the finish up button the code builds that application and then before I can interact with it, advances on to the next cycle to build the one for the next location. I need to have a way to pause the code when the application is done building, and automatically kick start it back up once I've hit the finish up button. I'm not sure if it'll be helpful, but I'm attaching some code. The first dialogue comes in at line 5, then if you select yes, it'll pull data from our internal server.. this won't run for anyone else (lines 24 - 638), then the application is built off the data table the previous code built.  (646 - 1069), then the code repeats but for a different set of data (line 1080).

 

jthi
Super User

Re: delay code until application is completed

I'm not that familiar with JMP Applications/Dashboards (I always build them myself to have full control) but you would want that the section after 1080 isn't executed until user presses "Finish Up"

-Jarmo
RVhydrA
Level III

Re: delay code until application is completed

I came up with a "solution." I simply put a wait command before line 1080 

If( Event["eventtype"] == 1,

     wait(30);
);

so if "Yes" was selected earlier, it knows that I generated an application and need to have time to interact with it. This gives the user 30 seconds to complete that action, "finish up" and then it'll move on to the next component of the script... its a functional solution though not what I'd have preferred. Certainly puts the user "on the clock" I'll have to mess around with the wait time to find a happy medium. Thanks for your help.. it got me thinking. 

jthi
Super User

Re: delay code until application is completed

I sent you a message in which I show what I might have done. I basically would move the second part of the script into expression (I would make other separations to improve readability but that should be the only "necessary" one) and then add that to the button5 function/script. This would make the expression trigger when the button5 is pressed. That option might require some additional work depending on how the scopes and namespaces are being handled.

-Jarmo