cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
%3CLINGO-SUB%20id%3D%22lingo-sub-347663%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EWait(0)%20vs%20Wait(n)%20vs%20Run%20vs%20Finish%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-347663%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20have%20very%20large%2C%20and%20constantly%20growing%20data%20tables%20so%20I%20have%20issues%20with%20formulas%20not%20finishing.%20I%20wish%20JMP%20would%20just%20build%20in%20a%20mechanism%20to%20stop%20scripts%20from%20continuing%20until%20each%20line%20has%20finished%20but%20perhaps%20there%20is%20a%20reason%20for%20not%20doing%20this%20I'm%20not%20thinking%20of.%20I%20typically%20use%20a%20wait(n)%20command%20(e.g.%20wait(30)%3B)%20however%20as%20the%20dataset%20grows%20I'm%20constantly%20having%20to%20update%20countless%20instances%20of%20%22wait%22%20throughout%20the%20thousands%20of%20lines%20of%20code%20as%20the%20tables%20become%20to%20large%20for%20certain%20lines%20of%20code%20to%20finish%20evaluating.%20I%20later%20thought%20I%20had%20learned%20that%20wait(0)%3B%20would%20be%20dynamic.%20It%20would%20wait%20as%20long%20as%20is%20needed%20to%20finish%20the%20evaluation%20before%20moving%20to%20the%20next%20line%2C%20so%20I%20changed%20everything%20to%20wait(0)%2C%20but%20now%20many%20lines%20are%20failing%20to%20complete%20and%20thus%20the%20script%20is%20breaking.%20Was%20I%20wrong%20to%20think%20that%20the%20wait(0)%3B%20command%20would%20be%20dynamic%20as%20I%20described%3F%20I%20tried%20%22Run%22%20and%20%22Finish%22%20commands%20but%20neither%20worked.%20I%20went%20back%20and%20put%2C%20for%20example%2C%20a%20wait(30)%3B%20in%20one%20place%20and%20it%20worked%20again..%20so%20am%20I%20stuck%20with%20these%20static%20time%20increments%20that%20I'll%20inevitably%20have%20to%20continue%20changing%20over%20time..%20or%20am%20I%20doing%20something%20wrong%20here%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-347663%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAutomation%20and%20Scripting%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-347958%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Wait(0)%20vs%20Wait(n)%20vs%20Run%20vs%20Finish%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-347958%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20think%20if%20you%20have%20formulas%20in%20the%20tables%20you%20are%20joining%2Fupdating%20then%20it%20could%20help.%20I%20think%20I%20have%20never%20had%20issues%20with%20directly%20related%20to%20JMP%20data%20tables%20which%20would%20have%20required%20me%20to%20use%20wait%20(mostly%20issues%20have%20been%20related%20to%20some%20variables%20not%20getting%20values%20or%20with%20visualisations%20in%20new%20window).%20I%20don't%20know%20enough%20technical%20details%20what%20JMP%20is%20doing%20in%20background%20so%20maybe%20you%20could%20try%20emailing%26nbsp%3B%3CA%20href%3D%22mailto%3Asupport%40jmp.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Esupport%40jmp.com%3C%2FA%3E%26nbsp%3Bfor%20assistance%3F%20Also%20tagging%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F6878%22%20target%3D%22_blank%22%3E%40Jeff_Perkinson%3C%2FA%3E%20based%20on%20this%20old%20response%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FDiscussions%2FHow-can-I-force-my-script-to-execute-sequentially%2Fm-p%2F18437%23U18437%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-forum-thread%20lia-fa-icon%20lia-fa-forum%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3EHow%20can%20I%20force%20my%20script%20to%20execute%20sequentially%3F%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECouple%20of%20questions%3A%3C%2FP%3E%0A%3CP%3EAre%20you%20using%20Current%20Datatable()%20to%20reference%20to%20datatables%3F%20Which%20JMP%20version%20are%20you%20using%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELinks%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F15.2%2Findex.shtml%23page%2Fjmp%2Fscripting-data-tables.shtml%23ww2071832%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F15.2%2Findex.shtml%23page%2Fjmp%2Fscripting-data-tables.shtml%23ww2071832%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F15.2%2Findex.shtml%23page%2Fjmp%2Fscripting-numbers-strings-arrays-and-lists.shtml%23%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2Fen%2F15.2%2Findex.shtml%23page%2Fjmp%2Fscripting-numbers-strings-arrays-and-lists.shtml%23%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-347708%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Wait(0)%20vs%20Wait(n)%20vs%20Run%20vs%20Finish%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-347708%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20shouldn%20have%20specified%20that%20its%20not%20only%20formula%20evaluations%20but%20actions%20like%20opening%20and%20joining%20or%20updating%20another%20table%2C%20sorting%20a%20table%2C%20etc..%20will%20those%20commands%20work%20on%20things%20that%20aren't%20formulas%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-347684%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Wait(0)%20vs%20Wait(n)%20vs%20Run%20vs%20Finish%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-347684%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHave%20you%20tried%20using%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%26lt%3B%26lt%3B%20Run%20Formulas()%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Eor%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%26lt%3B%26lt%3B%20Rerun%20Formulas%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Eto%20my%20understanding%20with%20these%20JMP%20should%20wait%20for%20formula%20evaluation%20to%20finish%20before%20it%20continues.%3C%2FP%3E%3CP%3EOther%20possible%20options%3A%20Also%20are%20formulas%20necessary%3F%20Could%20you%20manage%20with%20%3CEM%3E%26lt%3B%26lt%3B%20Set%20Each%20Value%3C%2FEM%3E%20instead%20of%20Formulas%3F%20Also%20maybe%20use%20of%20%3CEM%3Edt%20%26lt%3B%26lt%3B%20Begin%20Data%20Update%3C%2FEM%3E%3B%20and%20%3CEM%3Edt%20%26lt%3B%26lt%3B%20End%20Data%20Update%3C%2FEM%3E%3B%26nbsp%3B%20could%20be%20of%20use.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Wait(0)%20vs%20Wait(n)%20vs%20Run%20vs%20Finish%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EIn%20General%2C%20I%20used%20%26lt%3B%26lt%3B%20run%20formulas%20in%20my%20scripts.%3C%2FP%3E%3CP%3EBut%2C%20I%20agree%20to%20what%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3947%22%20target%3D%22_blank%22%3E%40RVhydrA%3C%2FA%3E%26nbsp%3Bwrote.%3CBR%20%2F%3EFrom%20what%20is%20written%20in%20the%20scripting%20index%2C%20%3CFONT%20face%3D%22courier%20new%2Ccourier%22%3Ewait(0)%3C%2FFONT%3E%20should%20do%20the%20same%20job%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22hogi_0-1731304755634.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1731304755634.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22hogi_0-1731304755634.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70018iCAA9EE5B405BD235%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22hogi_0-1731304755634.png%22%20alt%3D%22hogi_0-1731304755634.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-810275%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Wait(0)%20vs%20Wait(n)%20vs%20Run%20vs%20Finish%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-810275%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CUL%3E%0A%3CLI%3EUse%20wait(0)%20to%20make%20windows%20appear%20and%20make%20buttons%20work%20during%20a%20loop.%3C%2FLI%3E%0A%3CLI%3EUse%20%26lt%3B%3CRUNFORMULAS%20for%3D%22%22%20forcing%3D%22%22%20evaluation%3D%22%22%20of%3D%22%22%20data%3D%22https%3A%2F%2Fcommunity.jmp.com%2F%22%20table%3D%22%22%20formulas%3D%22%22%20to%3D%22%22%20complete.%3D%22%22%3E%3C%2FRUNFORMULAS%3E%3C%2FLI%3E%0A%3CLI%3EUse%20wait(1)%20to%20make%20a%20script%20run%20slower%2C%20perhaps%20to%20visualize%20a%20progression%20of%20changes.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EJMP's%20table%20formulas%20evaluate%20in%20the%20background%2C%20when%20JMP%20is%20idle.%20Wait(%20n%20%26gt%3B%200%20)%20makes%20JMP%20be%20idle%20so%20the%20formulas%20can%20evaluate.%20The%20idle%20time%20formula%20evaluation%20is%20quite%20slow%3B%20using%20dt%26lt%3B%3CRUNFORMULAS%20will%3D%22%22%20be%3D%22%22%20dramatically%3D%22%22%20faster%3D%22%22%20if%3D%22%22%20there%3D%22%22%20are%3D%22%22%201e6%3D%22%22%20rows%3D%22%22%20in%3D%22%22%20the%3D%22%22%20table.%3D%22%22%3E%3C%2FRUNFORMULAS%3E%3C%2FP%3E%0A%3CP%3EMany%20data%20table%20commands%20have%20the%20%26lt%3B%3CRUNFORMULAS%20built%3D%22%22%20in%3D%22%22%3E%0A%3C%2FRUNFORMULAS%3E%3C%2FP%3E%3CP%3EWait(n)%20idle%20time%20allows%20the%20operating%20system%20to%20update%20the%20display%20and%20send%20keystrokes%20and%20mouse%20clicks%20to%20your%20program.%20If%20you%20write%20a%20loop%20with%20no%20wait(0)%20idle%20time%20that%20opens%20and%20closes%20platforms%2C%20you%20won't%20see%20any%20activity%20on%20the%20display.%20If%20you%20need%20to%20see%20the%20windows%20popping%20open%2C%20a%20wait(0)%20is%20appropriate%20there.%20There%20is%20a%20small%20time%20penalty%20for%20wait(0)%20as%20well%2C%20even%20if%20nothing%20happens.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
RVhydrA
Level III

Wait(0) vs Wait(n) vs Run vs Finish

I have very large, and constantly growing data tables so I have issues with formulas not finishing. I wish JMP would just build in a mechanism to stop scripts from continuing until each line has finished but perhaps there is a reason for not doing this I'm not thinking of. I typically use a wait(n) command (e.g. wait(30);) however as the dataset grows I'm constantly having to update countless instances of "wait" throughout the thousands of lines of code as the tables become to large for certain lines of code to finish evaluating. I later thought I had learned that wait(0); would be dynamic. It would wait as long as is needed to finish the evaluation before moving to the next line, so I changed everything to wait(0), but now many lines are failing to complete and thus the script is breaking. Was I wrong to think that the wait(0); command would be dynamic as I described? I tried "Run" and "Finish" commands but neither worked. I went back and put, for example, a wait(30); in one place and it worked again.. so am I stuck with these static time increments that I'll inevitably have to continue changing over time.. or am I doing something wrong here?

5 REPLIES 5
jthi
Super User

Re: Wait(0) vs Wait(n) vs Run vs Finish

Have you tried using:

dt << Run Formulas();

or

dt << Rerun Formulas;

to my understanding with these JMP should wait for formula evaluation to finish before it continues.

Other possible options: Also are formulas necessary? Could you manage with << Set Each Value instead of Formulas? Also maybe use of dt << Begin Data Update; and dt << End Data Update;  could be of use.

 

-Jarmo
RVhydrA
Level III

Re: Wait(0) vs Wait(n) vs Run vs Finish

I shouldn have specified that its not only formula evaluations but actions like opening and joining or updating another table, sorting a table, etc.. will those commands work on things that aren't formulas?

jthi
Super User

Re: Wait(0) vs Wait(n) vs Run vs Finish

I think if you have formulas in the tables you are joining/updating then it could help. I think I have never had issues with directly related to JMP data tables which would have required me to use wait (mostly issues have been related to some variables not getting values or with visualisations in new window). I don't know enough technical details what JMP is doing in background so maybe you could try emailing support@jmp.com for assistance? Also tagging @Jeff_Perkinson based on this old response How can I force my script to execute sequentially? 

 

Couple of questions:

Are you using Current Datatable() to reference to datatables? Which JMP version are you using?

 

Links:

https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/scripting-data-tables.shtml#ww2071832 

https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/scripting-numbers-strings-arrays-and-l... 

-Jarmo
hogi
Level XII

Re: Wait(0) vs Wait(n) vs Run vs Finish

In General, I used << run formulas in my scripts.

But, I agree to what @RVhydrA wrote.
From what is written in the scripting index, wait(0) should do the same job:

hogi_0-1731304755634.png

 

 

Craige_Hales
Super User

Re: Wait(0) vs Wait(n) vs Run vs Finish

  • Use wait(0) to make windows appear and make buttons work during a loop.
  • Use <<RunFormulas for forcing evaluation of data table formulas to complete.
  • Use wait(1) to make a script run slower, perhaps to visualize a progression of changes.

JMP's table formulas evaluate in the background, when JMP is idle. Wait( n > 0 ) makes JMP be idle so the formulas can evaluate. The idle time formula evaluation is quite slow; using dt<<RunFormulas will be dramatically faster if there are 1E6 rows in the table.

Many data table commands have the <<RunFormulas built in ( dt<<sort, for example.) But operations like row indexing ( dt:height[i], for example ) do not, and an explicit <<RunFormulas is recommended (before the loop, not in the loop...there is a small time penalty even if it does nothing.)

Wait(n) idle time allows the operating system to update the display and send keystrokes and mouse clicks to your program. If you write a loop with no wait(0) idle time that opens and closes platforms, you won't see any activity on the display. If you need to see the windows popping open, a wait(0) is appropriate there. There is a small time penalty for wait(0) as well, even if nothing happens.

 

Craige