Hi,
I’m doing an addition but sometimes users do not need to fill out all the fields.
If the user is not required to fill out ALL the fields, then the addition does not work because there’s one field missing. So it returns NaN.
Is there a smart way to have a sum operate correctly even if one of the addition fields is not filled out?
Example:
I want to order a coffee for $2 with milk ($1). It should cost $3.
There’s an option of making it a large size for $2 more, but I don’t want the larger size.
Now the “extra size” field in the sum is empty, so when adding to $3, it will return an error. → How would you recommend solving it?
I’m curious, how do you have the database set up for your products and add-ons? There may be an even easier solution to this. I would just need to know how you have it configured. Screenshots could help too.
In my case, the collection is called Option1 and the price is Price.
for the total price in the DB Create/Update action, sum up the values from the inputs:
See if it works for you
How does this work for me: after I change the dropdown, values in inputs are changed immediately. Upon pressing update the price is calculated correctly, even if one or several dropdowns are unselected.
Given the fact that Adalo can change the behaviour quickly, including setting default values for the variables and inputs, I have no idea for how long will this workaround work But now it could be an option.