Answered

Rank choice quiz results with primary and secondary categories


Here is what I am trying to do.  The quiz I am writing tallies up points in three categories.  Based on the user’s answers, they can either be categorized into one of these three categories, or be categorized into one category as a primary and another category as the secondary.  The quiz tallies up three category variables and then converts them into a percentage of total at the end.  

Here is the logic:

Category 1 >= 75%:  Category 1 ending page:

Category 2 >= 75%:  Category 2 ending page:

Category 3 >= 75%:  Category 3 ending page:

All categories < 75%, Category 1 is largest, and Category 2 > Category 3:  Category 1-2 Landing page

All categories < 75%, Category 1 is largest, and Category 3 > Category 2:  Category 1-3 Landing page

All categories < 75%, Category 2 is largest, and Category 1 > Category 3:  Category 2-1 Landing page

All categories < 75%, Category 2 is largest, and Category 3 > Category 1:  Category 2-3 Landing page

All categories < 75%, Category 3 is largest, and Category 2 > Category 1:  Category 3-2 Landing page

All categories < 75%, Category 3 is largest, and Category 1 > Category 2:  Category 3-1 Landing page

 

In order to do this, I need to be able to store a result of aa operation on 2 variables into a 3rd.  

Does anyone know how to do that?

icon

Best answer by john.desborough 26 July 2021, 18:19

View original

11 replies

Userlevel 7
Badge +5

Hi @kmoore02809 Welcome to the community! How are you adding up the scores? Are you using variables to do so? 

While I don’t think you’ll be able to convert as a percentage at the end of the form, you should be able to show the final amount. 

@john.desborough  @vickioneill or @Paulo may have some advice on how to set this up!

Userlevel 7
Badge +6

@kmoore02809 @Liz - the percentage is not actually that hard (honest!!) - you just need to divide your category score by total available then multiply by 100 and use @recall with the % sign just after when displaying ie if catA is 72 and total is 84 then  (72/84) * 100 = 85.71 %

the calculation comparison logic is not that complex but it will seem to be ‘cumbersome’ to create the logic conditions and rules to get it right … especially since there could be ties…. @kmoore02809  → is there a possibility that there could be ties and, if so, how would you break them?

this is not dissimilar to other posts where I have shown the logic framework. 

 

des

 

Here is what I am trying to do.  This is an ayurveda skin care quiz for my wife’s company.  Ayurveda classifies people generally into one of three doshas (Vata, Pitta, and Kapha).  Most people are not just in one dosha, but are classified as sharing two out of the three.

The quiz asks the user a number of multiple choice skin care questions.  Depending on the response, I increment the value of a vata, pitta, or kapha variable.  Once the quiz is done, I express them as a percentage.  That’s not difficult to do.  The post-processing rules I apply are as follows:

If a user comes out as greater than 75 percent of their answers as one dosha, they are wholly in that dosha and get the ending page for that dosha. So greater than 75% vata gets the vata ending page, greater than 75% pitta gets the pitta landing page, and greater than 75% kapha gets the kapha landing page.

 

It’s the dual doshas that are causing me a problem.  Say I have a quiz that results in a user being:

50% vata

28% pitta

22% kapha

I want to be able to compare the vata percent variable to the pitta and kapha percent variables, determine it is larger, and then take the larger of the two remaining variables and assign the dual dosha accordingly.

I can’t seem to figure out how to compare one variable directly to another.  In the logic window, I seem to only be able to compare a variable to a constant.  I can’t compare a variable to another called variable.  Is there some connection I am not seeing.  

If it were only a matter of coding I could solve it easliy.

 

Userlevel 7
Badge +6

here is quick summary - 

  • create variables as follows:
    • v_vata numeric default to 0 
    • v_pitta numeric default to 0
    • v_kapha numveri default to 0 
    • v_vata_gt_pitta numeric default 0
    • v_vata_gt_kapha numeric default 0
    • v_pitta_gt_kapha numeric default 0
    • v_vatta_bigger_pitta text default no
    • v_vatta_bigger_kapha text default no
    • v_pitta_bigger_kapha text default no
  • logic goes like this:
    • if v_vatta is gt 0 then add v_vatta to v_vatta_gt_pitta
    • if v_pitta is gt 0 then subtract v_pitta from v_vatta_gt_pitta
    • if v_vatta_gt_pitta is greater than 0 replace v_vatta_bigger_pitta with yes
    •  
    • if v_vatta is gt 0 then add v_vatta to v_vatta_gt_kapha
    • if v_kapha is gt 0 then subtract v_kapha from v_vatta_gt_kapha
    • if v_vatta_gt_kapha is greater than 0 replace v_vatta_bigger_kapha with yes
    • ..
    • if v_vatta_bigger_pitta is yes AND v_vatta_bigger_kapha is yes THEN jumpto ending page for vatta

you would need to look at the combinations and determine your path based on this style of logic. what i showed does not account for ties. 

des

Userlevel 7
Badge +5

Well, I’m terrible at math, @john.desborough ! Percentages are hard haha! Thank you for this - so handy!! Let us know how this goes for you, @kmoore02809 .

Userlevel 7
Badge +5

Well, if there’s anyone who can elaborate at the level of detail and understanding on a request like this, it’s @john.desborough ! I hope this works for you, @kmoore02809 .

Thanks for the tag, @Liz. I’m glad des got to this before me as I don’t think I have the brain power or focus for figuring that out like he does. He certainly has a gift!

Userlevel 7
Badge +5

He really does, @vickioneill ! Imagine combining his logic brain with your creativity! 

 

Userlevel 7
Badge +6

i hate it when the images don’t show up lol.. 

 

 

Hi John,

Thanks for the info.  I applied your logic (very clever) to my quiz and it seems to work.  Thanks so much for your help!

Userlevel 7
Badge +6

@kmoore02809 - glad to hear! with only three categories, it is a relatively few number of comparisons that have to be done.. try this with 12 categories to compare?? lol wait.. don’t do that, it’s not fun lol

Userlevel 7
Badge +5

@john.desborough It might be after a glass of scotch. 

 

Reply