I have set up a dropdown list on a VFE form. It is pulling in the problem list. However some of our problems contain commas and it is separating those problems into multiple lines. I would like them to be listed the same way the CPOE-CCC form does.
For example on the VFE form it appears:
Osteoarthritis
knees
bilateral (ICD-715.96) (ICD10-M17.0)
On the CPOE form it appears:
Osteoarthritis, knees, bilateral (ICD-715.96) (ICD10-M17.0)
I have the dropdown list set up with
Type: New Observation
Name: CUR PROB #1
MEL {PROB_AFTER("comma")}
How can I get my list to appear as it does on the CPOE-CCC form?
I got this from here and it works great.
in your listbox make it dynamic
{fnproblemcheck_AP(PROB_AFTER("delimited","","",
"Orthopaedics","undimmed"))}
in the box on the right side
!fn fnproblemcheck_AP(strlist)
{ local strproblemlist
local nstart
local strbuf
local strformattedlist = ""
strproblemlist = getfield(strlist, "|","")
for i = 1, i <= size(strproblemlist), i=i+1 do strproblemlist[i]=getfield(strproblemlist[i],"^","")
strBuf = fnConvertProblemTypeToString_AP(strProblemList[i][1], FALSE) + strProblemList[i][2]
strBuf = ReplaceStr(strBuf, ",", "")
strFormattedList = strFormattedList + strBuf + " ("
strBuf = strProblemList[i][3]
strBuf = ReplaceStr(strBuf, ",", "")
strFormattedList = strFormattedList + strBuf + ")("
strBuf = strProblemList[i][8]
strBuf = ReplaceStr(strBuf, ",", "")
strFormattedList = strFormattedList + strBuf + "),"
endfor
return (strFormattedList)
}
!fn fnConvertProblemTypeToString_AP(strType, bIncludeDx)
{
strType = tolower(strType)
cond
case (strType == "dx of")
if (bIncludeDx) then
return ("Diagnosis of ")
else
return ("")
endif
case (strType == "mdxof")
return ("Minor diagnosis of ")
case (strType == "h/f")
return ("Hospitalized for ")
case (strType == "hx of")
return ("History of ")
case (strType == "s/p")
return ("Status post ")
case (strType == "r/o")
return ("Rule out ")
case (strType == "? of")
return ("Question of ")
case (strType == "sx of")
return ("Symptom of ")
case (strType == "rs of")
return ("Risk of ")
case (strType == "note:")
return ("Take note of ")
case (strType == "fh of")
return ("Family history of ")
endcond
return ("")
}
John, you over achiever with your fancy pictures... 😀
Looking to use a drop down list. Not a list box. Can you offer any guidance for the drop down list? Thanks!
Try the following MEL code in your VFE form. You need to set up your dropdown list control on the form as a dynamic choice list. The MEL expression for the dropdown list references a global variable that gets initialized with the comma delimited list of active problems when the form first opens because the dropdown list value is equal to a blank string when the form opens. The trick is to ignore any commas in problem list descriptions. I've commented the code for clarification. The figure shows the settings for the dropdown list control on your form.
//Initialize dropdown list containing active problems
{
!if DOCUMENT.DDL_PROBLIST == "" then
local strProbDesc = ""
local strICD10 = ""
local probs = getfield((PROB_AFTER("delimited")),"|",",") //treat any commas that appear in description as white space
local numprobs = size(probs) //identify number of rows in problems array and store in numprobs variable
local i = 1
//Parse parameters for each active problem and store in two-dimensional array
for i=1, i <= numprobs, i=i+1
do
probs[i] = getfield(probs[i],"^","")
endfor
//Populate dropdown list of active problems
for i=1, i <= numprobs, i=i+1
do
strProbDesc = probs[i][2]
if (probs[i][8] == "") then
strICD10 = "No ICD-10 Code"
else
strICD10 = remove(probs[i][8],1,6) //strip off ICD10- prefix from ICD10 code
endif
//construct comma delimited list of dropdown values
if (i == 1) then
MyProbList = strProbDesc + " (" + strICD10 + ")"
else
MyProbList = MyProbList + "," + strProbDesc + " (" + strICD10 + ")"
endif
endfor
else
endif
}
I used jfitzmd's solution and it worked great.
One question though - if I pull up the form with the dynamic problem list then subsequently add another problem to the patient's problem list, the dynamic list doesn't update until I move to another form then back to the original form with the dynamic problem list. I thought I could add a button that would essentially run a watcher that would cause the form to update to include the newly added problem but I can't get it to work.
Any suggestions?
Sorry if this is a rookie question - I'm reasonably new to MEL.
Thanks!
I'm not sure about John's solution but I don't have that problem with the code I submitted, it updates immediately.
an alternative would be to use replacestr to replace a comma with a character that looks similar, such as a low acute accent using numtoascii
This didn't work. It still recognized the comma and caused the problem to separate to multiple lines 🙁
Terribly sorry. I see now that I misunderstood the question. The other posters are correct. You will need to substitute a different character for the commas that are contained in the problem description prior to constructing the comma delimited list that the list box will use as a dynamic variable. I apologize for my oversight. Let me know if the other solutions don't work for you. I could modify my code to include a function that is called to remove the commas and replace with a non-comma character. I liked Ken's suggestion to use a character that looks similar, such as a low acute accent using numtoascii() function. A semi-colon (;) would also work.
If it is not too much to ask would you mind adding it to your function for me? It would be appreciated more than you know. I have tried to get it to work and have not had any luck. I am new to MEL and will not have any training until October and then hopefully I can be less reliant on users such as yourself for things that are seemingly so simple.