create a function with a while loop and call it between your other 2 functions.
{fn Timer(time)
{
local x = 1
while x <= time do
x = x + 1
endwhile
}
}
pass in the amount of time to wait.
Is there any type of wait command in MEL? I'm trying to add some error checking in to a form and some of the functions take a second to complete, so I'd like to add a wait command before the error checking line... has anyone else come up with a workaround or other way of doing this?
My current problem is that periodically the MEL_ADD_MEDICATION() function adds the medication to the med list, but doesn't add the script. I'm using the LISTRXNEW() function to make sure it was added and display a yes/no if it wasn't (clicking yes brings them to the script form to enter it manually). I'm getting some false positives on our live system and I'm pretty sure it's because of timing, since I'm not getting them on my local eval version.
Word of caution for using a while loop as a "timer." Depending on the processing speed of the server that is hosting and running this code, the speed at which the "pause" will happen for will be different. It will also be factored in with how much load is on that server at the time of the code execution. I believe this will only be an issue for when you take this code from one server to another, and they have varying processing speeds.
So, if you had a slow processor executing this while loop built to pause for 2 seconds on a faster processor, you could see a 10 second wait instead (or more).
I saw that when going from test to live. Anyone know of any other solutions to accomplishing this?
This might not be clean enough for production, but it will work for testing:
Create a batch file called sleep.bat with the contents:
timeout %3 /nobreak
Then call it from your form:
runtextprocess("C:\Program Files (x86)\Centricity Practice Solution 100 Client\sleep.bat","5")
The second parameter is the number of seconds to wait.
This may not be what you're looking for, but I programmed a form to display "Please wait..." until a function is complete.
I have a button of type "RUNPROCESS" that looks like this:
{
timer = 888
--code I want to execute--
timer = 999
}
Then, I have a visibility region tied to "timer = 888" with the "Please wait..." language, and another on top of it tied to "timer = 999" with "Thank you, your whatever is complete."
I'm actually really happy with the way it turned out.