Answered

Multiply a product variable (price) and its result add it to a subtotal variable

  • 19 February 2021
  • 2 replies
  • 553 views

Userlevel 2
Badge

Hi, I have a question related about subtotals. 

My typeform is a shopping cart, with 4 kind of groups of services, each services are integrated with several products. I need to get 4 different kind of sub totals and adds each subtotal to the score at the end of the process. 

I created a variable to each product (each with its price)
And created a variable to each subtotal (each with value 0 -zero-)

here my question:

  • Can I multiply a product variable (price) and its result add it to one of the subtotal variable?

thanks in advance

icon

Best answer by john.desborough 19 February 2021, 15:25

View original

2 replies

Userlevel 7
Badge +6

@sebastiancv - this is from a user of Typeform

while not exactly identical to your use case, the thread at this link here shows how ‘math logic’ was used to make calculations .. 

that might help move the needle a bit.. until someone from the Community team can fill in the blanks in a more fulsome fashion

 

des

Userlevel 7
Badge +5

Hi @sebastiancv ! The link @john.desborough shared is a good workaround for this. One thing I’ve been made aware of is that our calculator has some unexpected limitations to it that are a little tricky for the developers to fix, so something to note in the meantime: 

• Calculations associated to an Always conditions are executed when the Typeform is loaded and not when the respondent reaches the given block, therefore causing unexpected behavior.
• The work around is to attach an IF condition to the calculation. This way, the calculation will only be executed when the respondent reached the block with the condition attached.

This may or may not end up applying to your setup, but I wanted to share with you just in case!

Reply