I am trying to complete a calcuation that looks like this:
what is the price of A?
what is the price of B?
If price of A = greater than 100 - add 20 to price of A and multiply ques1 by .80. Then add 10 to ques2 price of B and subtract that from the first result.
If price of A = lower than 100 - add 20 to price of A and mulitply ques1 by .90. Then add 10 to ques2 price of B and subtract that from the first result.
And then I want to take those values and use them to branch later in the form.
Thank you @john.desborough ! How would I use the total from those scenarios to branch in the form. For example if question C equals less than the other total, then move forward, if it is greater than total return to a previous form question.
Thank you! @john.desborough how do you recall the calculation result though? I’m not sure how to find those totals. Where does the result of “if q1 gt 100 multiply v_A_calculated by 80” get stored and how do I recall that as a function for branching later?
@larawilliams0501 - you can show the result (or any variable) using the @recall function - type the @ sign and you should be able to see the list of variables.
in the example you stated, let’s say that the q1 answer was 110 … the logic rule multiplies the variable by the number and it is stored AS the variable ie 110 x 80 = 8800. the next step to divide it by 100 is t0 make it the decimal value...minor drawback of typeform = 8800 / 100= 88
the value of the variable is now 88..
to use it for branching you can then use logic rules like this:
if v_A_calculated is less than or equal to 80 go to q5
if v_A_calculated is greater than 80 and v_A_calculated is less than or equal to 90 go to q6
Hey @john.desborough or @Liz I’m trying to include a power function into the calculator to achieve something similar to a retirement calculator. Any possibility Typeform would be able to support something of this nature or a possible workaround?
I’ve not tested this out extensively but you would need to do something like this:
q1 - ask for the base value you want to ‘raise to the power’ - start a test with pick a number from 1-5
q2 - ask for the number to be used as the ‘to the power of’ figure - test with 1-5 as well ie 2 would be squared, 3 = to the third, etc.. (hoping this is where you are trying to get)
create a counter variable into which you would put the ‘to the power of’ value ie v_p_counter = 0 to start
create a calculated total variable to hold the results of the calculation v_total
use logic rule to add the value of the power question to the counter variable
create logic rules to perform the calculations something like this
add q1 to v_total
multiply v_total by 1
subtract 1 from v_p_counter
if v_p_counter is = 0 kick out to ending
if v_p_counter is greater than 0 then multiply v_total by q1
this would give you the square value now
subtract 1 from v_p_counter
if v_p_counter is = 0 kick out to ending
if v_p_counter is greater than 0 then multiply v_total by q1
this would give you the square value
subtract 1 from v_p_counter
if v_p_counter is = 0 kick out to ending
in theory that might work. the problem with this type of logic is that you really need to cap the number of iterations - there is no concept of looping over a calculation … so i can’t guarantee this will even work but it would walk through the cycle that you would need
i think you would be better off connecting this to google sheets and having the formulas there do the calculation and sending the user the output in a follow up email.
Is there anything the roadmap to at least allow for a formula to be written in typeform instead of using standard operators for ± - * / ? It’s brutal to have to chain together logic like this when you have a few long operations. Allowing you to simply say store the output of ((a*b)-(x/y)) as an example would basically turn typeform into a no code programming language. it’s what you do already you just make users go through a deep unnecessary level of brain damage.
Is there anything the roadmap to at least allow for a formula to be written in typeform instead of using standard operators for ± - * / ? It’s brutal to have to chain together logic like this when you have a few long operations. Allowing you to simply say store the output of ((a*b)-(x/y)) as an example would basically turn typeform into a no code programming language. it’s what you do already you just make users go through a deep unnecessary level of brain damage.
I mean even one step further, I understand that this existing logic functionality might be more complex on the backend than normal users realize but since Typeform is trying to integrate more AI, that’s a beyond superb use case for AI...allow me to give it a regular complex formula, and understand the context with regard to what variables i’m trying to use, what I’m trying to output, and output that in the form of these logic branches that Typeform natively uses. Would save a world of hurt and showcase the power of AI in your tool.
Hi @jasonb we don’t currently have anything like this in the roadmap, but I’ll share it with the product team! I never even thought of having something like this using AI.
@jasonb - i proposed a ‘logic block’ approach ie create a question type that was solely a set of logic rules that you could insert for processing between pages/questions, rather than having to put them into a question page. Also added the extension to that, to allow for creating a library of pre-defined logic blocks that could be included in our personal ‘library’ … so that you could define the formula one - like you mention above - and create the block just for that… that way you could drop that one into any quiz you want… (still need to do a little massaging of that block to identify which questions would in use, etc… but better than having to re create it every time)