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?
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.
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?
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
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:
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.