Best Practices for Complicated Calculations?

This isn’t very complicated, but it’s complicated for Bubble it seems.

What is the best way to take a number X and calculate a new number Y that is X~TIMES~100-(.03X~TIMES~100) but keeping only 2 decimal places?

I’m using stripe and need to add a 3% fee onto an amount to charge to stripe, which only accepts the amount in pennies (not dollars).

Is there a best way to do this in stripe? Seems dead simple if there were parenthesis in the dynamic data area, but I’m not sure there are.

NOTE: You can’t use * in these conversations. It doesn’t work. So I used the word TIMES instead.

you can do exactly that (it’s as simple as you think it should be) as long as you either have parenthesis turned on or the new Beta expression builder.

Oh wow. Thanks! Do you know where the option is to turn parenthesis on is? The UI is more than half the battle on bubble. ha ha

It’s in your App Settings, in the Versions tab, under Beta Features:

Thank you!! Did not know that existed

Still struggling a little bit with the interface. I seem to have been able to get the parenthesis right, but I want to take that whole thing and multiply by 100 now to pass to stripe.

I can’t seem to control the parenthesis.

Stupid question, I know, but it’s very awkward to use.

How could I multiply that whole expression times 100? No option I can find to do that. Nothing comes up on the dynamic data menu. It’s straight to trying to add in a new object, rather than allowing me to multiply all that times 100

It takes a bit of getting used to… but you control the position of the parentheses by which ‘more’ button you click.

So to multiply the whole expression by 100, just click the last more button and then add x 100

image

Then you can format the number however you like (but you can’t use decimals for Stripe, only integers)

Thank you for babysitting me through that. I was not easy and somehow I ended up with extra parenthesis. I had to add it in a certain order then go back and edit. Still very awkward but I think it worked!

Thanks so much. That is the kind of stuff you can spend hours on with bubble

1 Like