Hello chuggers!
I have a VFE from that I'm using to parse ORDERS_NEW and compare to a
ORDER_CUST_LIST. The end-goal is to be able to separate out orders of different types for documentation and instruction purposes (our docs want to separate out labs from other types of tests etc.). The challenge I am facing is that once the orders have been created and translated out to the form text, they do not update like ORDERS_NEW usually do (say a provider adds or removes orders before signing). I've attempted to use watcher functions to overcome this, but to no avail. Here is the main function i am using for comparison:
{!fn fnSHOW_CURRENTLY_ORDERED(in_string,arg){
// variable that builds our string that we will later output:
// 4-17-2013 how about setting up an array, instead? that way we could do something with each element…
local build_string = ""
// variable to store the Order Description (field #1):
local current_new_order
// variable to store the Order Code (field #3):
local current_new_order_code
// variable to store the Order Comments (field #8):
local current_new_order_comments = ""
// variable to store current ORDERS_NEW for comparrison:
local new_orders
//variable for building our array
local ary
new_orders = getfield(ORDERS_NEW('delimited'), "|","")
for ii = 1, ii <= size(new_orders), ii = ii + 1 do
new_orders[ii] = getfield(new_orders[ii], '^', '')
current_new_order = new_orders[ii][1]
current_new_order_code = new_orders[ii][3]
// check to see if instructions are to be included or not
if arg=="instructions" then
current_new_order_comments = FMT("instructions:", "I,U,-1") + " " + FMT(new_orders[ii][8], "-1") + HRET + HRET
else
current_new_order_comments = ""
endif
// Check "current_new_order" variable and compare to our custom order list which is temp variable (in_string)
// If equal, set to "build_string" variable, otherwise do nothing and move on to next order
ary = getfield(ORDER_CUST_LIST(in_string), '|','')
for b = 1, b <= size(ary), b = b + 1 do
ary[b] = getfield(ary[b], '^','')
if ary[b][2] == current_new_order then
// Build a string that adds each "ary" to the next with a new line after each
build_string = build_string + FMT(current_new_order, "B") + " [" + current_new_order_code + "] " + HRET + current_new_order_comments
endif
endfor
endfor
if in_string == 'Labs Specialty' and build_string <> "" then
build_string = insert(build_string,1,specialty_pre) + specialty_post
endif
if (build_string <> "") then
return build_string
else
return ""
endif
}}
In the VFE form translation "Chart Note" area, calling the function works as expected upon order placement. The problem is if any orders are added or removed as the chart note does not update.
Can anyone lend some advice?
Thanks so much in advance!
The '!' only forces the function to execute at form load. Add a dummy parameter to your function and pass in Orders_New(). Don't do anything with it in the function. It just forces the function to execute whenever Orders_new changes.
jjordet said:
The '!' only forces the function to execute at form load. Add a dummy parameter to your function and pass in Orders_New(). Don't do anything with it in the function. It just forces the function to execute whenever Orders_new changes.
Thanks, jjordet. You're always so helpful!
I am already passing in Orders_New() here:
new_orders = getfield(ORDERS_NEW('delimited'), "|","")
Should I do something differently? Like this?:
local dummy = Orders_New()
I'll try that for sure, I just don't understand how the latter changes when the function executes versus the former.
how are you calling this function?
jjordet said:
how are you calling this function?
I currently have this function stored in my mellib.txt
I've tested calling it several different ways, all with the same results (static chart note text that doesn't update). I'm currently calling the function from a VFE form data display's Translation tab in the "Chart Note" area like this:
{CFMT(fnSHOW_CURRENTLY_ORDERED('Labs In',''), "", "Labs Ordered:" + HRET, "B,2", "
","")}
there's nothing here to trigger the function.
add dummy arg:
{!fn fnSHOW_CURRENTLY_ORDERED(in_string,arg, dummy){
don't do anything with it in the function.
call the function like:
{CFMT(fnSHOW_CURRENTLY_ORDERED('Labs In','', ORDERS_NEW()), "", "Labs Ordered:" + HRET, "B,2", "
","")}
this way anytime orders change, the function will be called.
jjordet said:
there's nothing here to trigger the function.
add dummy arg:
{!fn fnSHOW_CURRENTLY_ORDERED(in_string,arg, dummy){
don't do anything with it in the function.
call the function like:
{CFMT(fnSHOW_CURRENTLY_ORDERED('Labs In','', ORDERS_NEW()), "", "Labs Ordered:" + HRET, "B,2", "
","")}
this way anytime orders change, the function will be called.
I see! So ORDERS_NEW() needs to be a dummy argument for the function. Got it! I'm sure that will do the trick.
Thank you very much, jjordet! You are the best. I'll let you know the results.
Side note, I'm surprised that Centricity doesn't already have this functionality built-in somewhere. We can't be the only group to need a separation of order types, can we? Perhaps there is a better/different way that we just did not think of? No big deal, just seems logical.
@jjordet Yep! Followed your last instructions and, sure enough, the Chart Note is now a true dynamic representation of the orders. I'll remember this for future development.
Thanks again, really! I owe you (several) cups of coffee 🙂