Calculation in Results Page | Community
Skip to main content
Answered

Calculation in Results Page


Forum|alt.badge.img

Hi everyone, I’m trying to build out a quiz that asks for a number (annual cost) and service (multiple choice). Each option on the multiple choice is tied to a percentage and the results page should display the final calculation of Annual Cost * Service Percentage. Is there a way to set up logic that will display that amount? Thank you in advance for the assistance!

Best answer by john.desborough

@Liz - correct 

  • create a variable say v_total
  • logic rules
    • if annual cost is greater than 0 add annual cost to v_total
    • if mc is A then multiply v_total by value for A 
    • if mc is B then multiply v_total by value for B

note that since you can’t have a decimal value in the for “value of A”, etc. you would then have to divide the v_total by 100 to make it work out.. ie 1000 x 40 / 100 is the way to calculate 1000 * .4

 

des

View original

5 replies

Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14971 replies
  • March 15, 2024

Hi @shoon Thanks for stopping by the community! I believe you would need to add one of these numbers into a variable in order to multiply them both at the end - @john.desborough is that correct? Or am I doing my math wrong. 🤣


john.desborough
Forum|alt.badge.img+6
  • Certified Partner & Champion
  • 5300 replies
  • Answer
  • March 15, 2024

@Liz - correct 

  • create a variable say v_total
  • logic rules
    • if annual cost is greater than 0 add annual cost to v_total
    • if mc is A then multiply v_total by value for A 
    • if mc is B then multiply v_total by value for B

note that since you can’t have a decimal value in the for “value of A”, etc. you would then have to divide the v_total by 100 to make it work out.. ie 1000 x 40 / 100 is the way to calculate 1000 * .4

 

des


Forum|alt.badge.img
  • Author
  • Explorer
  • 6 replies
  • March 19, 2024

Thank you @Liz and @john.desborough for your responses and advice! What I ended up doing on the logic:

Enter annual cost (number field)

Select Service (multiple choice option)

If Service is A, then multiply variable @total_savings by a decimal value tied to the service. 

 


john.desborough
Forum|alt.badge.img+6
  • Certified Partner & Champion
  • 5300 replies
  • March 20, 2024

well done @shoon .. glad that helped


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14971 replies
  • March 20, 2024

Oh lovely! Glad to hear that worked, @shoon , and thanks @john.desborough for the help! Let us know if you have any other questions, @shoon . 😀


Reply