Answered

Variables and logic


I want to calculate a cost based on two variables: 

  1. size of an area (value is pre-defined)
  2. standard of finishing (value is pre-defined)

How do I then calculate the results based on the range of different inputs for size and standard? 

icon

Best answer by john.desborough 10 May 2022, 03:42

View original

3 replies

Userlevel 7
Badge +6

@David A - welcome to the community

here’s one set of thoughts on the matter:

  • assuming that you have 3 questions - one for the respondent’s name,  one for the area and one to select standard of finishing: 
    • create a variable for the result of the calculation ie call it v_subtotal 
    • when someone answer the area question you create a logic rule that says something like this: 
      • if Q2 (the answer selected) is greater than 0 then add q2 answer to v_subtotal
      • jumpto to the next question 
    • the logic rule the next question is something like this - assuming that the responses for the question are good, better, best: 
      • if q3 (this question is a multiple choice) = a then multiply v_subtotal by 30
      • if q3 = b then multiply v_subtotal by 50
      • if q3= c then multiply v_subtotal by 75

the resulting value in v_subtotal is the result of the area * the cost per square foot (at least in this hypothetical example in my head) 

 

does that make any sense??

 

des

Thanks for the reply Des. 

The question for area is displayed as a multiple choice with pre-defined answers and an “Other” option for the user to provide a specific area size as an alternative to the pre-defined value. When we try to create the calculation it does not allow us to recall the number that is inserted in Other? Please can you advise? 

David  

Userlevel 7
Badge +6

@David A - the issue with the Other field is that the response is a ‘text string’ and not a number. 

i know it may seem like a pain BUT suggestion is this: just create a choice called Other (not the ‘Other field type from the toggle’) and if they choose Other, use the logic rules to jump to a number question where you ask them to input the number. then you can do the calculations.. 

 

des

Reply