Is there a way to do UNIT TESTIN /DEBUG of MEL code, using VFE do to custom forms
its a hassle uploading the form to Centricity and do manual test.
Thanks,
e. Vazquez
Unfortunately I don’t believe there is any kind of emulator or test environment, so deploying VFE forms with custom code is a pain. It is best to set up a test folder that you can deploy your forms to and test before deploying. This strategy allows you to make changes or revisions to existing forms without affecting the production form. Once it is working, you can change the deployment folder to the production location and re-import the clinical kit.
I have a simple form that use for development to speed things up. Its a big text box with an action button. All the action button needs is {eval(eval(document.text_box))}. Then i can do things like userok("HI!") and I get a popup. It also has a code file stored locally in the client. I can open the file, write out a function, use load() to load the function on the fly, and then try to run it passing various options on the main form. Then when it works copy it to a form I'm developing or a userlib file and I'm done. Its a lot easier than importing a form over and over again.
Very clever Mr. Gibson. I’ll be using this as a resource for testing quick texts and custom functions moving forward.
Thanks for posting!
thanks for your tip
thank you Mr. Sir gibsonmi
There are a lot of possibilities with this setup, I hope its helpful. Let me know if you have any questions setting it up.
My form has three buttons actually, they use these three functions. DOCUMENT.STATE is the big box, DOCUMENT.HOLD_FIELD would be the bottom box. I also have it looping through lines, so I can run multiple code snippets in one go. The first just runs it, the second adds the popup for you, the third copies the result below. As for the logging, click CTRL+ALT+M and it will turn on a MEL trace. Then you can read through it, for CPS its in C:\Users\[username]\AppData\Local\Centricity\Logs and cEMR is C:\Users\[username]\AppData\Roaming (I think).
{fn CMDRun(){
local CmdHold = getfield(document.state,hret,"")
for CmdInt = 1, CmdInt<=size(CmdHold), CmdInt = CmdInt + 2 do
eval(eval(CmdHold[CmdInt]))
endfor
}
}
{fn CMDPopup(){
local CmdHold = getfield(document.state,hret,"")
for CmdInt = 1, CmdInt<=size(CmdHold), CmdInt = CmdInt + 2 do
eval(eval("userok(" + CmdHold[CmdInt] + ")"))
endfor
}
}
{fn CMDCopy(){
local CmdHold = getfield(document.state,hret,"")
for CmdInt = 1, CmdInt<=size(CmdHold), CmdInt = CmdInt + 2 do
eval(eval("document.hold_field = " + CmdHold[CmdInt]))
endfor
}
}
sweeet, thanks !! : ) : O : S
I was actually doing it the hard way , I had traced the id of the box
DOCUMENT.OUTPUT_4930153306534643939
DOCUMENT.OUTPUT_4930153306534643939 = "something"
but your code is legit, thanks again
I'll probably bug you some more, but with this I have all I need for now
Cheers,
e. Vazquez
In VFE make sure you check the box for 'Make available to Other Forms.' What that does is remove the formId from the end of the variable name. Obviously if you use the same name in two forms and have that option checked in both then they will tie to the same variable. Anytime you want to read or write to a variable with eval() (or MEL in general) its a lot easier if that option is checked.
pro tips ; )
thanks again
e. Vazquez
Excellent David, thank you, sharing is caring, and this forum is the best I've encountered, such responsive and caring community of professionals.
Cheers,
e. Vazquez