Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

FormCalc question: How to count true/false answers

Avatar

Former Community Member
Using LiveCycle Designer 8.0 I have created a form questionnaire where some 25 questions can be answered with True or False. I designated this text field as true_or_false_field. At the end of the form I wanted to count the number of True answers and the number of False answers and put the totals in number fields called true_total and false_total.



With FormCalc, how do I do this, i.e., count the True and False answers?



Thank you for your help.
5 Replies

Avatar

Level 7
For the "True" number field you can the following calculation event":



var Tsum = 0 // zero accumulator

for i = 0 upto 24 step 1 do // loop through the fields

if (Lower(True_or_False[i]) eq "true") then // if answer for occurrence i is true

Tsum = Tsum + 1 // then add 1

endif

endfor

Tsum // post result

Avatar

Former Community Member
I have the same issue, but I have a series of unconnected fields that are set to either "Y" or "N" I want to tally the Y's. How can I get a for / do function to work with a series of differently named fields?

Avatar

Level 1

Did you ever resolve this? I'm have the same issue.

Avatar

Level 6

Create a series of Yes and No checkboxes.  I named the Yes boxes all the same.

Calculate script placed in a yes total field :   Sum(Yes[*]).

You can do the same if you want to sum the No responses.