Confiforms Checkbox Group Values

Randy Frennette January 10, 2024

Hello, having some trouble.  I have a bunch of fields and they are all Checkbox group (ID 1, Label=Yes, ID 2, Label=No)  I simply want a field definition rule that will "Set Value" in my Total Field instead of it showing the formula.  The formula evaluates correctly so I was expecting Total to equal 1 + 1 for a total of 2?  The formula I cannot create is to calculate the number of checkboxes with "Yes" checked.  I am aware the formula will go into "Value to Set" Total = (EQUALS("[entry.Response1]", "Yes") + EQUALS("[entry.Response2]","Yes") + ....) where sum is all of the fields that are equal to "Yes" which I thought may evaluate to 1 if true and 0 if false.

Any direction would be appreciated.

Thanks,

Question.jpg

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 11, 2024

Hi @Randy Frennette 

If I understand you correctly then you will need to use the "Set Expression" rule instead and have someting like

Total=([entry.Response1] + [entry.Response2])

Alex

Randy Frennette January 11, 2024

Gives me the following: error com.vertuna.confluence.plugins.confiforms.util.Expression$ExpressionException: Too many operators or functions at: +

However I got it working with this:

Total=ZEROIFEMPTY("[entry.Response1.label:Yes]") + ZEROIFEMPTY("[entry.Response2.label:Yes]")

Please confirm the following:

  1. ID appears to be the value of the label.  I thought it was just a key.  For example. I have Checkbox Group ID 1 = Label Yes and ID 0 = Label No. In Set Expression rule above it adds up to 2 which is perfect.  If I change ID 2 = Label Yes it add to 4. This is wonderful to evaluate different weightings of questions. I could say Response1 answer yes is worth 1 point where a more important Response2 could be worth 3 points.
  2. The adding of ZEROIFEMPTY got rid of an error on total line when form loads and nothing checked yet.
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2024

Well, if you allow empty values then - Yes, you need to account and handle that and ZEROIFEMPTY is a good helper function

ConifForms stores IDs that you define for your choice based fields

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events