Expand my Community achievements bar.

Script to calculate fields

Avatar

Level 1

I am new to LifeCycle Designer and need a field to show the sum of checkboxes i select throughout the form.  Can anyone please assist?

1 Reply

Avatar

Level 6

There are several ways to accomplish this depending on the design/layout/structure of your form.

One simple way is by using 3 different check boxes with different names, and a numeric field to display the sum. NOTE: all fields in this example are contained within the same subform:

Check box field names (NOTE: the export value of each check box is equal to "1" when checked, "0" if unchecked):

Checkbox1

Checkbox2

Checkbox3

Numeric field name:

TotalField

FormCalc script on TotalField, using "calculate" event:

$ = Sum(Checkbox1,Checkbox2,Checkbox3)

OR

Javascript script on TotalField, using "calculate" event:

this.rawValue =  Checkbox1.rawValue + Checkbox2.rawValue + Checkbox3.rawValue;

As mentioned, there are several ways of accomplishing this task. The above is a basic approach.

Hope this helps.