I'm making a questionnaire form and instead of these multiple checkboxes with sentence like statements documenting top to bottom I believe there is an easier way to make them document left to right with commons than going to one translations area of a checkbox and doing something like document.whatever + "," + document.whatever2 + "," + and so on. I'm thinking theres a functions that can be built in the fn pane to accomplish this quicker, i'm just not sure how.
Any help would be great, thanks in advanced.
These will probably be useful for you -
/*Count the number of arguments present and creates a comma list*/
{fn fnCommaCombine(){
local rslt = ""
for i = 1, i <= getnargs(), i = i + 1 do
rslt = fncombineutility(rslt,getarg(i))
endfor
return rslt
}}
/*used by fnCommaCombine*/
{fn fnCombineutility(one,two){
local combinestr
if (one <> "") and (two <> "") then
combinestr = one + ", " + two
return combinestr
else
combinestr = one + two
return combinestr
endif
}}
{fn ListToAnd(list){
if (list <> "") then
local andarray = ""
andarray = getfield(list,",","")
if size(andarray)>2 then
set(andarray,size(andarray)," and" + andarray[size(andarray)])
else if size(list)>1 then
return replacestr(str(andarray),","," and")
else return str(list) endif endif
else return "" endif
return str(andarray)
}}
You can create your text like this -
{ListToAnd(fnCommaCombine(document.var1,document.var2))}}
for as many variables as you want
Thank! Very useful
Can this be used with single answer radio buttons?
Also where do I place {ListToAnd(fnCommaCombine(document.var1,document.var2))}} when theres multiple check boxes and edit fields.
Yes it works for any combination of form fields. Basically, the first part (fncommacombine() part) will create a comma list (eg. item1, item2, item3) and the second one adds the word "and" if and where it is needed to make it grammatically correct (eg. item1, item2, and item3)
Do I call the fn form the text translation of the form field?
The functions go in the code panel, the part you quoted in post 4 would go in the text translation box
Thanks once again!
Is it possible to change the document font size to 11?
I think you need to change it in eacxh variable, I dont know if there is a way to do it for a document or form.
Hello All,
I do not know if this has been done before, but I am facing a challenge
where instead of doing the test translation directly into the office note
chart, the doctors wanted it (translation) to appear first in a multi-edit field
on the same form. Then they want to assign that the translation to an obs term,
so they can bring it in next time.
I can see that the code above will help me assigning multiple values from
different controls on the form.
Any ideas will help.
Thanks
Husam Y.
{OBSNOW("WhateverYourObsIs", ListBoxResult(DOCUMENT.LISTBOX,DOCUMENT.LISTBOX2,DOCUMENT.LISTBOX3,DOCUMENT.LISTBOX4))}
{fn ListBoxResult(stra,strb,strc,strd){
local whlstr=""
if (size(stra) > 0) then
whlstr = stra
endif
if (size(strb) > 0) and whlstr <> ""
then whlstr = whlstr + ", " + strb
else if (size(strb) > 0) and whlstr == ""
then whlstr = strb
endif
endif
if (size(strc) > 0) and whlstr <> ""
then whlstr = whlstr + ", " + strc
else if (size(strc) > 0) and whlstr == ""
then whlstr = strc
endif
endif
if (size(strd) > 0) and whlstr <> ""
then whlstr = whlstr + ", " + strd
else if (size(strd) > 0) and whlstr == ""
then whlstr = strd
endif
endif
return whlstr
}}
//**use this in the translation of the first item**//
{fn ListBoxTranslation8(stra,strb,strc,strd){
local whlstr = ListBoxResult8(stra,strb,strc,strd)
return cfmt(whlstr, ",1", + "
", ",1", "
", ",1")
}}
Then tie your Edit field to "WhateverYourObsIs"
Thank you very much, I will try this code.
If it doesnt work check to see if listboxtranslation has the 8 behind it. I took it off in some places but missed a few so here is the exact code i use:
{OBSNOW("Plan", ListBoxResult8(DOCUMENT.LISTBOX,DOCUMENT.LISTBOX2,DOCUMENT.LISTBOX3,DOCUMENT.LISTBOX4))}
{fn ListBoxResult8(stra,strb,strc,strd){
local whlstr=""
if (size(stra) > 0) then
whlstr = stra
endif
if (size(strb) > 0) and whlstr <> ""
then whlstr = whlstr + ", " + strb
else if (size(strb) > 0) and whlstr == ""
then whlstr = strb
endif
endif
if (size(strc) > 0) and whlstr <> ""
then whlstr = whlstr + ", " + strc
else if (size(strc) > 0) and whlstr == ""
then whlstr = strc
endif
endif
if (size(strd) > 0) and whlstr <> ""
then whlstr = whlstr + ", " + strd
else if (size(strd) > 0) and whlstr == ""
then whlstr = strd
endif
endif
return whlstr
}}
{fn ListBoxTranslation8(stra,strb,strc,strd){
local whlstr = ListBoxResult8(stra,strb,strc,strd)
return cfmt(whlstr, ",1", + "
", ",1", "
", ",1")
}}
Thank you very much Adam