Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

help with some basic 'sum' script with 'if'

Kobi_Cohen
Level 1
Level 1

hi,

i need to create a 'sum' field that will calculte fieldA*fieldB*fieldC.

fieldA and fieldB are regular numeric fields so sum (fieldA*fieldB) works just fine.

what i need is fieldC to be a radio button, so that when Option1 is checked then multiply by 4, and when Option2 is checked then multiply by 8

how do i do that?

please consider that my scripting knowledge is far less than basic, so be gentle...

tnx

Kobi

0 Replies
whyisthisme
Level 7
Level 7

Your calculate script in formcalc could be:

if (fieldC == 1) then

$ = fieldA*fieldB*4

elseif (fieldC == 2) then

$ = fieldA*fieldB*8

endif

just make sure you have "Specify Item Values" checked for your radio buttons under Object > Binding. Also at the moment it will show '0' if none of the buttons are checked so you could put in an 'else' condition if you want it to show something else.

Kobi_Cohen
Level 1
Level 1

it worked, many thanks!!!

is there any "formcalc for dummies" i can look at?

whyisthisme
Level 7
Level 7

The logic of formcalc is similar to visual basic. The help files that come with LiveCycle are very good for syntax.