How do I get the selections from two or more list boxes to one observation term? (If I apply the New OBS term to each list box the selections from 1st list box deselects once items in other list box is selected. These are not 'opposing' list boxes.)
You need to concatenate the list box strings. You need to check for null values when you do the concatenation. The watcher function is Fill_ObsTerm() which calls the function to populate the obs term where the arguments are the listbox fieldnames.
{ Fill_ObsTerm(document.listbox1,document.listbox2)}
{ fn Fill_ObsTerm(str1,str2)
{
local strObsTerm=""
if str2=="" then
strObsTerm=str1
else
strObsTerm=str1+(if str1=="","",",")+str2
endif
obsnow("OBS TERM",strobsterm)
}
}
2 listboxes ListboxA1 and ListboxA2
listA = listboxA1 + "," + listboxA2
OBSNOW("x",listA)
This code should do the trick. If either Listbox is clicked, this code runs due to the watcher !
{!if DOCUMENT.ListboxA1<>"" OR DOCUMENT.ListboxA2<>"" then
local ListA = ""
ListA = DOCUMENT.ListboxA1 + (if DOCUMENT.ListboxA1<>"" AND DOCUMENT.ListboxA2<>"", ",","") + DOCUMENT.ListboxA2
OBSNOW("x",ListA)
else
OBSNOW("x","")
endif
}
~ Beverly