1

I have a quiz that I have created with Cognito Forms. I want to be able to display one of four different answers to the user when he/she finishes the quiz. I have two conditional fields that sum up the value of the answers resulting in either a value above 0 or below. I need another conditional logic field to determine if the other two fields are above 0 or below zero.

So, Case 1: Condition1 > 0 && Condition2 > 0; Case 2:Condition1 < 0 && Condition2 > 0;

and so on and so forth.

How do I code a conditional field statement that evaluates the value of the other two conditional field values?

And do I need to set them to text or number since the value in the two conditional field statements are numbers?

I'm used to select case statements in VBA, but haven't got my head wrapped around Cognito's logic yet.

0

I'm a developer with Cognito Forms.

You should be able to set up a Calculation field, that checks the two conditional fields. The best way to go about doing this would be to set up the conditional fields to a type of number. You can then check them to see if they are > 0 or if they are < and > 0.

Building the calculation for this without knowing what you want to display or what the field names are can be a bit tricky, but you should be able to use something close to the following.

=if (Condition1 > 0 and Condition2 > 0) then 1 else if (Condition1 < 0 and Condition2 > 0) then 2 else 0

You can continue with this for as many if/else statements as you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.