I have a form that is made up of list boxes. I need to take the answer from a list box, assign a number to the answer and then all the sum of all the list boxes. The part I don't know how to do is assign a numeric value to the various list box options. For example, my list box options may be Normal symmetrical movement, minor paralysis, partial paralysis or complete paralysis. I need to conver those answers to a number. I have done other forms where the answer to the query was an actual number and I was able to make the calculation work so I think I'll be okay with doing the calculation.
Thanks
Debbie
we do this in drop-downs/listboxes:
0-not at all, 1-several days, 2-more than half the days, 3-nearly every day
and then add them like this:
{GAD7(DOCUMENT.FEELING, DOCUMENT.WORRY, DOCUMENT.WORRYING, DOCUMENT.TROUBLE, DOCUMENT.BEING, DOCUMENT.BECOMING, DOCUMENT.AFRAID)}
{fn GAD7()
{
local number_args = GETNARGS()
local answer = 0
local count
local this_arg
for count = 1, count <= number_args, count = count + 1 do
this_arg = GETARG(count)
if this_arg<>"" then
answer = answer + VAL(SUB(this_arg, 1, 1))
endif
endfor
OBSNOW("GAD SCORE", STR(answer))
return ""
}
}
Perfect!!! Thank you so much. Worked like a charm.
Debbie
This will only get the first one in a list box though.