Hi,
I currently have a laundry system where my user can submit the weight of a bag and then a price gets sent to their customer based on a price per pound price. As it is I have the formula written out in my action (Total Bag Weight * 1.5). The issue with this is i have the calculation in various places on my bubble app so if i ever decide to change the pricing I’d have to go and manually do it everywhere that the function exists. I would like to make it so that it becomes dynamic. I want to create a field or an option set or a new type in my data that would allow me to change the pricing as needed while simultaneously changing it across the functions. I have an idea of how to make this happen but I do not know how to do it in bubble. Any help or suggestions would be much appreciated.
I have added an image showing an example of the function. The 1.5 is what I’d want to have replaced to become dynamic.

Hello @danieleyny
Several ways to skin this cat.
One could be to introduce a priceDataType. You would be using an object (a dataType) instead of fieldOfTypeNumber. When the object (in this case … the priceObject) is part of another object (the productObject) … you can just change the priceObjectsActualPriceFieldOfTypeNumber and this changes it to all of the products that have this priceObject.
@danieleyny If I understand you need correctly, you basically are asking how to dynamically use the value of 1.5 in your calculation so that you can change the value of 1.5 in one area and not need to update all of your calculation expressions.
This would be best done via an option set. For example, I’d call the Option Set ‘Options - Calculation - Values’…I’d call the value of 1.5 as ‘weight multiplier’ so I’d have a display value of ‘weight multiplier’ and the option set would have an attribute called ‘Value’ of type number, to which for ‘weight multiplier’ I’d set to 1.5.
Then in your dynamic expression for Total Tenant Price it would look like Total Bag Weight's value * get option 'Options - Calculate - Values' 'weight multiplier's' 'Value'' + Additional Service Price's Value
Then if in the future you want to change the value of 1.5 to say 2.3 for example, all you need to do is go to the option set in your database and locate change the ‘Value’ on the ‘weight - multiplier’ option from 1.5 to 2.3…all expressions will then use the 2.3 and you won’t need to change any expressions in your app at all.
You can do the same thing for each of the other static values you have in the screen shot, but each is it’s on own option in the option set, so you would have if you are using 1.5, 0.5, 0.029 and 0.3 a total of four options within the single option set.
Working with option sets is better than data types for this use case as there is no need for a search and the option sets are pre-loaded and available, so much easier to manage the expressions but also cheaper to operate the app with.
Yeap. Agree with Boston for sure! … for a use case as detailed 
I have implemented apps where different pricing tiers are used … which becomes more intricate. Those even got to the point of having to use both dataTypes and optionSets to be able to manage different prices according to XYZ pricingStrategyOrChannelPricingApproach along with how to increaseOrdecrease them as needed 
You’re the man! Thank you so much, the solution did exactly what I wanted and the explanation was super detailed.
1 Like