Does anyone know if you can take 3 separate listboxes, tie them all to the same observation term, but have different values in all of the listboxes? I have a list of 40 symptoms but they all need to write to the same observation term but don't want a listbox 40 lines tall and don't want to scroll forever. Thanks
Yes, this is doable. You will need to include a watcher expression for each listbox in your MEL code to monitor the three list boxes and then update the OBS term accordingly. If you want to concatenate multiple symptoms, the update expression would look something like this:
if OBSNOW("your term") == "" then
OBSNOW("your term", DOCUMENT.listbox[a,b,or c])
else
OBSNOW("your term", OBSNOW("your term") + ", " + listbox[a,b, or c])
The first condition adds one or more selected symptoms if nothing has been recorded for the OBS term; otherwise it will concatenate additional symptoms to the text already recorded. Make sense? You could also reference a function when the watcher expression fires to better format what gets translated into the OBS term. For example if you only had one symptom checked amongst all three listboxes it would just record the one symptom. If two symptoms were selected, it would record "symptom 1 and symptom 2". If 3 or more symptoms selected, it would record "symptom 1, symptom 2, ..., and symptom n". Feel free to reach out if you need more assistance.
thank you. One of the issues is that we are using an online form for the patient to enter information so when we pull that information in and use default prev we get the information into the form.
If you are trying to read data from a file, you should still be able to do it but you will need to write a function that parses out all of the symptoms and then check each separate listbox to identify the ones that should be checked. I would probably bind each list box to a variable instead of an OBS term and then have a button to update the OBS term once the listboxes were updated. You could also use a watcher expression to update the OBS term each time someone interacted with the listbox.
{ConcatenateLists(document.list1,document.list2,document.list3)}
{fn ConcatenateLists(str1,str2,str3)
{
local newstr=str1
newstr=AddStr(newstr,str2)
newstr=AddStr(newstr,str3)
obsnow("QUESTION #1",newstr)
}
}
{ fn AddStr(constr,addstr)
{
if addstr=="" then
return constr
else
return constr+(if constr=="","",",")+addstr
endif
}
}
This code takes the contents of three lists boxes document.list1,2,3 and concatenates the values into the obsterm QUESTION #1. In the form I created, this populates a data display. There is an issue of how contents of multiple selections within a single list box are returned with a preceeding space, but that is a separate issue. If you want the VFE test form, contact me a [email protected].