Answered

Complex calculation


Hello

I’m trying to calculate a price based on a few answers.

The form logics branches to 2 cases, and each case has 3 cases.

I’ll try to describe the calcuation:

Let factor1, factor2 = constant1, constant2

Let price1, price2, price3 = constant_price1,  constant_price2, constant_price3

 

 

I will then need to create a new factor number, and multiply it by one of the prices.

So if the user answers question 1 with A, I’ll use the answer multiplied by factor1,

and if they answer B, I’ll use the answer multiplied by factor2

I then need to use the results and multiply it by either price1, price2 or price3, depending on the answer of question #2.

I’m unable to do it though, because I can’t save the new factor into a new variable.

 

What’s the solution for that?

Thank you

icon

Best answer by guym88 13 June 2022, 19:02

View original

5 replies

Userlevel 7
Badge +5

HI @guym88 Welcome to the community! I don’t *think* this is possible, but @john.desborough is great at math and can confirm this for me. 😂

Can you share a bit more about the form you’re building and what exactly you’re calculating? 

Userlevel 7
Badge +6

@guym88 

i think the logic you need to follow is this 

  • create the variable for factor3
  • logic rules like this:
    • if q1 = A then add answer A to factor3 
    • if q1 = A then multiply factor3 by factor1
    • if q1 =B then add answer B to factor3
    • if q1=B then multiply factor3 by factor2
    • if q2 = A then multiply factor3 by price1
    • if q2= B then multiply factor3 by price 2
    • if q2=C then multiply factor3 by price 3

that should give you the the ‘third factor’ value based on what you are describting 

 

des

Thank you

I solved the issue by discovering that I can do two things I didn’t know I can:

  1. Put a constant number in a variable depending on an answer
  2. Put an answer in a variable

Thank you!

Userlevel 7
Badge +5

Thanks for circling back, @guym88 ! Glad you were able to solve the issue!

Userlevel 7
Badge +5

Hey @guym88! Happy you could solve the issue. By the way, why don't you send us the link to your form? I'd love to take a look at the final result! 😊

Reply