I want to compare @score variable with another variable for equality instead of 0. Can it be done?
Best answer by john.desborough
View originalI want to compare @score variable with another variable for equality instead of 0. Can it be done?
Best answer by john.desborough
View originalhere’s a ‘way’ to do this check for equality
if the result of the subtraction is = 0 then the two values are equal.
Hi
In my typeform assessment, I’m trying to validate all of the multiple choice answers by comparing a few of them against each other. I’m taking 10 of the questions and making sure the scored answers are within 1 point, essentially for validity.
This is how the answers are scored (some are scored exactly this way, while some are reverse-scored):
I need to compare 5 different questions directly against one other question, (so 10 questions in all, in 1:1 comparisons). so I’m thinking that your technique in this thread is my best bet!
My questions are these:
I also don’t want it to show up within the Typeform itself, but just create a variable to be sent to Zapier, so I don’t need a different ending screen or anything.
Thank you for your service!
can you clarify the following for the seven other voices in my head who will work on this while i sleep:
to me that would compare the question responses to as follows:
all three of those conditions seem to be the match for your logic ie a 1 and 5 would be either 4 or -4 and outside the range ..
hopefully that makes sense - it does mean you need some ‘scratch pad’ variables to do the calculations (don’t use @score!!)
hopefully that makes sense..
cheers
des
(However, I am using @score for the main score, separate from this “equality” test within the main assessment”)
I will give your logic a whirl and report back. Thank you!! Seriously you are a logic & scoring whiz.
1- The first step you laid out is inputting:
But they will both always be greater than 0 because they are both required questions, and the lowest option is 1... What do you recommend in that case?
2- The ‘close_enough_4_10’ variable would be a text variable too yes? (in order to replace it with “yes”?) What should the starting variable be?
Thank you thank you! This is so above my capabilities right now, I am learning a ton from you.
you can set the close enough variable (text) to a default of no and replace it with yes in the logic.
For anyone who thinks
Here is how it works:
If I have variables a, b, and c that each store a value and I want to show the user a slide based on whichever variable is the highest this is the simple logic you need to use.
if (initiating event = true)
a - b
if (a > 0)
a + b
if (a > 0)
a - c
if (a > 0)
go to slide for when a is the greatest variable (if this is not true it will continue on to compare b to all other variables, which in this case is c because we already know a is smaller than b)
if (initiating event = true)
b - c
if (b > 0)
go to slide for when b is the greatest variable
if (initiating event = true)
go to slide for when c is the greatest variable
This solution works because Typeform is not asynchronous. If you understand the basic logic pattern, this can be adapted to compare any number of variables and is very easy to set up. I have used this to compare over 15 variables. I hope this helps!
That will get you to an ending if you have a unique high score possible at all times … it gets a little more complicated when you have the possibility of one or more categories being tied with the high score
you can throw in some ‘tie breaker logic too:
On each of those tie breaker pages you have the user make a choice and you get to the/an appropriate ending
des
Hi
That sounds like an interesting solution, as currently we do not offer a specific logic feature to directly compare variables with each other. Would you mind sharing the URL of the form where you implemented this set up and let us in support check your form’s logic? We’d be interested to see if we can make a section on the Help centre for this, as other users have been asking as well.
Hey
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.