Hello there!
I am trying to build a function that pulls a specific order into a letter based on a custom modifier. So far, I am able to neatly list orders using the following code:
{
global list = ""
global ords = getfield(ORDERS_AFTER("delimited"),"|","")
global ords2 = array
if ords <> "" then
for i=1, i<=size(ords), i=i+1 do
ords2 = getfield(ords[i],"^","")
list = list + "Procedure / Test: " + ords2[1] + hret +
"Dx Codes: " + ords2[7] + hret + ords2[26] + hret +
"Orders Start Date: " + ords2[4] + hret + "Orders End Date: " + ords2[5] + hret +
"Instructions: " + ords2[19] + hret + ords2[8] + hret +
"Service Provider: " + ords2[14] + hret + ords2[15] + hret +
"----------------------------------------------------------------" + hret + hret
endfor
else
list = ""
endif
list
}
However, I would like to add a line or another function that would exclude all orders in the letter unless it includes a certain "custom modifier" which will be in field [24].
Any direction with this code is greatly appreciated!
Thank you very much
-Richard
If anyone is interested in this post, I found the following post, which does exactly what I am asking for:
https://centricityusers.com/?pa.....ls/#p12891
I modified the code for my needs, to the following:
{fn Order_w_Details(orders){
local hold = getfield(orders,"|","")
local temp = array()
local rslt = ""
for i = 1, i<=size(hold), i = i + 1 do
temp = getfield(hold[i],"^","")
if temp[23] == "25" then
if rslt <> "" then
rslt = rslt + hret
endif
rslt = rslt + temp[1] + " (" + temp[7] + ") " + temp[19]
endif
endfor
return rslt
}}{Order_w_Details(ORDERS_AFTER("Delimited",""))}
Thank you CHUG community!!!