What my form is doing is pulling the prob list, order list by custom order list. User can select there diagnosis, select there order, and click a button that will add for x amount of time over x amount of months/occurrences.
Here' s acutally the bare bones of the pulling and passing taking place:
{!fn LoadOrderListBox(customlist){
local folist = ""
local oarray = getfield(ORDER_CUST_LIST(customlist),"|","")
local osize = size(oarray)
for counto = 1, counto <= osize, counto = counto + 1 do
local oneord = getfield(oarray[counto],"^","")
local tempord = ReplaceStr(oneord[2],",","\,")
if (folist == "" and oneord[1] <> "R" and oneord[1] <> "H" and oneord[1] <> "P") then
folist = tempord
else if (oneord[1] <> "R" and oneord[1] <> "H" and oneord[1] <> "P") then
folist = folist + "," + tempord
else ""
endif
endif
endfor
return folist}}
{!fn LoadProblemListBox(prob_after){
local plist = ""
local parray = getfield(prob_after,"|","")
local psize = size(parray)
for countl = 1, countl <= psize, countl = countl + 1 do
local onep = getfield(parray[countl],"^","")
local tempp = ReplaceStr(onep[2],",","\,")
if plist = "" AND onep[1] == "Dx of" then
plist = tempp
else if plist <> "" and onep[1] == "Dx of" then plist = plist + "," + tempp
else ""
endif
endif
endfor
plist}}
{!fn get_dx(sproblem,pos){
local dxlist = ""
local dxarray = getfield(PROB_AFTER("delimited"),"|","")
local dxsize = size(dxarray)
for countp = 1, countp <= dxsize, countp = countp + 1 do
local onedx = getfield(dxarray[countp],"^","")
if match(sproblem,onedx[2]) > 0 then
dxlist = dxlist + "|" + onedx[pos]
else ""
endif
endfor
if dxlist <> "" then local fdxlist = remove(dxlist,1,1) else "" endif
fdxlist}}
/*1 month*/
{fn add_1_month_order(clist,sorder,sprob,comment,sdate){
local ordera = getfield(ORDER_CUST_LIST(clist),"|","")
local ordersz = size(ordera)
for counta = 1, counta <= ordersz, counta = counta + 1 do
local oneorder = getfield(ordera[counta],"^","")
if match(sorder,oneorder[2]) > 0 then
/*MEL_ADD_ORDER(oneorder[1],oneorder[4],oneorder[2],"",get_dx(sprob,3),get_dx(sprob,2),comment,"","","",ADDDATES(str(._TODAYSDATE), "0", "0", "0"))*/
MEL_ADD_ORDER(oneorder[1],oneorder[4],oneorder[2],"",get_dx(sprob,3),get_dx(sprob,2),comment,"","","",ADDDATES(str(._TODAYSDATE), "0", "1", "0"))
else ""
endif
endfor
return blank}}