Is there a way to automatically add an order to a form without having to click anything?
I have added an action button to a form and it adds the order but this order needs to be sent everytime the form is used so I want it to add automatically. I have tried using the Mel_add_order function but obviously this is above my novice form building skills.
Thanks!
Off the top of my head try adding something like this into your form on the right side function window:
{!DOCUMENT.TEST = "."}
{if DOCUMENT.TEST = "." then MEL_ADD_ORDER("T", "All Labs", "Immunoglobulin A", "", "", "", "", "", "", "", "") else "" endif}
Created a radio button and what ever you name it put it where I have "DOCUMENT.TEST"
The help section is a good place to see the syntax of MEL_ADD_ORDER. It can be a little tricky. The "All Labs" is our name of our order list so you would need to replace it with yours also the "Immunoglobulin A" is ours so make sure the field is one of yours to.
Be careful how you 'automate' orders. Think in terms of user interaction and how the EMR works. You will need to perform a 'check' to see if the order has already been added so that it will not add upon subsequent openings of the form (otherwise you could end up with dozens of unintentional orders). You will also want to place a 'reminder' that is visible on the form that the order has been placed as well as a mention that if the form was added in error, the user will need to manually remove the order (automated anything quickly becomes forgotten). Expanding on the previous suggestion:
{ if document.check == "" then MEL_ADD_ORDER(........) document.check = "done" else "" endif}
{! document.check}
The first line looks at the 'check variable' to see if it has been executed yet. If yes, do nothing. If no, add the order and populate the 'check variable' with 'done'. There is no need for the document variable to reside on the form itself, as the second line is a variable declaration. Be certain to give it a unique name as this variable will reside in the 'global space' of the update and become accessible to other forms in the update.
Alternatively, you could match on the orders_new() data symbol if you needed finer control. Either approach will get you there.
Thank you both- worked perfectly!
Cheryl