Forum Academy Marketplace Showcase Pricing Features

Help with Forumla

Hey guys, so I’m setting up the the formula for how to show the user the cost before they make a purchase or sign up for a rental plan and I’m having trouble displaying the formula.

The factors are:

Elements rental rate ex:$1

Number of days to be rented

my fee that I collect from the transaction.

this is what I have so far for the formula in “pseudo bubble code”

(Items rental rate * number of days) + ((items rental rate * number of days) * .1)

so that way i’m only collecting 10% of the transaction. The question I have is how would I set that up so it can be displayed to the person making the transaction. I have the items rental rate as a thing so that is already figured out. I’m trying to use time picker to select the days which should start and stop the rental period but I’m having issues with it.

Any help is appreciated.

-Cflux

Hi @cflux

Not sure if you got to your answer already, but here’s a possible one for you:

Not sure how Bubble does calculations in Order of Operations, so I’ve split the formula into two parts:

Fee = ((items rental rate * number of days) * .1)
Total = items rental rate * number of days + Fee

In order to do the calculation you’re asking about, I created four input boxes, all with the type of “integer”:

  • Rental Rate
  • Days

  • Fee
  • Total

And two groups, with a content type of “number”, to pass the calculation of Fee and Total, which those inputs sit on (the colored area)

In order to do the calculation for Fee and Total, you need to use workflow to add/multiply the values, pass that data to a group, and have the Fee/Total field reference the group it’s sitting in.

Here’s what the “Fee” input field looks like; the Total field is configured the same way, getting the value from its parent group.

Now, using workflow, we do our calculation, and set the result to the group that the input field sits on. Do the same for the Total field, and you should be set!

End Result

2 Likes