I use this code in the watcher panel-
{!global plist}
/*Build problem list to choose from*/
{!if PROB_AFTER("LIST") <> "" then
plist = str(getfield(PROB_AFTER("LIST"),"\n",";,\r"))
else plist = "" endif}
/* Build diagnosis description string*/
{fn descr(dx){
local descri=""
local probarray = getfield(dx,",","")
local sprob = size(probarray)
if (sprob > 0) then descri = descri + sub(probarray[1],1,match(probarray[1]," (")-1) endif
if (sprob > 1) then descri = descri + "|" + sub(probarray[2],1,match(probarray[2]," (")-1) endif
if (sprob > 2) then descri = descri + "|" + sub(probarray[3],1,match(probarray[3]," (")-1) endif
if (sprob > 3) then descri = descri + "|" + sub(probarray[4],1,match(probarray[4]," (")-1) endif
if (sprob > 4) then descri = descri + "|" + sub(probarray[5],1,match(probarray[5]," (")-1) endif
if (sprob > 5) then descri = descri + "|" + sub(probarray[6],1,match(probarray[6]," (")-1) endif
if (sprob > 6) then descri = descri + "|" + sub(probarray[7],1,match(probarray[7]," (")-1) endif
if (sprob > 7) then descri = descri + "|" + sub(probarray[8],1,match(probarray[8]," (")-1) endif
return descri
}}
/* Build diagnosis code string*/
{fn icd_code(dx){
local pcode = ""
local probarray = getfield(dx,",","")
local sprob = size(probarray)
if (sprob > 0) then pcode = pcode + sub(probarray[1],match(probarray[1],"ICD"),size(probarray[1])-match(probarray[1],"ICD")) else "" endif
if (sprob > 1) then pcode = pcode + "|" + sub(probarray[2],match(probarray[2],"ICD"),size(probarray[2])-match(probarray[2],"ICD")) else "" endif
if (sprob > 2) then pcode = pcode + "|" + sub(probarray[3],match(probarray[3],"ICD"),size(probarray[3])-match(probarray[3],"ICD")) else "" endif
if (sprob > 3) then pcode = pcode + "|" + sub(probarray[4],match(probarray[4],"ICD"),size(probarray[4])-match(probarray[4],"ICD")) else "" endif
if (sprob > 4) then pcode = pcode + "|" + sub(probarray[5],match(probarray[5],"ICD"),size(probarray[5])-match(probarray[5],"ICD")) else "" endif
if (sprob > 5) then pcode = pcode + "|" + sub(probarray[6],match(probarray[6],"ICD"),size(probarray[6])-match(probarray[6],"ICD")) else "" endif
if (sprob > 6) then pcode = pcode + "|" + sub(probarray[7],match(probarray[7],"ICD"),size(probarray[7])-match(probarray[7],"ICD")) else "" endif
if (sprob > 7) then pcode = pcode + "|" + sub(probarray[8],match(probarray[8],"ICD"),size(probarray[8])-match(probarray[8],"ICD")) else "" endif
return pcode
}}
My diagnosis lists are in list boxes, choose dynamic options and write plist in the connection box. In the MEL add order use the second two functions with the problem listbox as the variable like icd_code(document.problemlist),descri(document.problemlist). You can add up to 8 diagnosis unless you adjust the function, I think max supported by GE is 12 but I doubt our users have ever added more than 3.