Upon siging the lab orders it displays a list of new orders on the text part of the encounter form (using order_list_change() I believe) like:
Added new Test order of BASIC METABOLIC PANEL (80048) - Signed
I am trying to list the order code and instructions for each of these lab orders:
something like (80048) "instruction: while fasting "
I am using the following, but I only get the info for the last lab order
{while ORDER_LIST_CHANGES() <> "" do
CFMT(ORD_COMMENTS(), "", " ", "B", "") +
CFMT(ORD_CODE(), "", "
", "B", "
")
endwhile
}
I think in order to get everything, you've got to use the ORDERS_AFTER() or ORDERS_ALL() MEL symbols. I wrote the following function which parses out the code and the comments:
{fn fnOrderDetails(){
local lOrderArray = getfield(ORDERS_AFTER("delimited"),"|","")
local lSize = size(lOrderArray)
local lCount
local lResult = ""
for lCount=1, lCount<=lSize, lCount = lCount + 1 do
lOrderArray[lCount] = getfield(lOrderArray[lCount],"^","")
lResult = lResult + lOrderArray[lCount][3] + ": " + lOrderArray[lCount][8] + HRET
endfor
return lResult}}
{fnOrderDetails()}
You can of course switch out the "ORDERS_AFTER" with "ORDERS_ALL" or "ORDERS_NOW" to only give you the orders for which you're looking.
Thank you for your response Sarah. But I think I am doing something wrong (obviously).
I copied your code to the left code of the VFE window, then created a button to RUNPROCESS with {fnOrderDetails()} but it is still not displaying any of the codes and instructions. I also tried it with MEL expression field.
Help please.
Sometimes when you copy code from here, you need to redo your quotation marks. Sometimes they end up being the wrong symbol.