Substraction button

FYI: the purpose of the app is for the person who access it to be able to select the food/drinks he ordered in restaurant/bar.

Context:
I created a “Sum” text cell (on the green circle) that displays the total amount that is being ordered. It works by displaying the sum of amounts retrieved from a database called ‘Items ordered’.
Through “Magic text > Database: ‘Items ordered’ > Price > Sum”. It then displays correctly the sum of the column “Prices” from the database ‘Items ordered’. → Nothing to report, it works perfectly, i.e. adding up the amounts works.
i.e. Button below :arrow_down:
image
The macro view of the screen :arrow_down:

My issue is the following:
My clear button is not functioning anymore. The “Clear” button is a trick I created to quickly reset the total amount displayed to the customer in the “Sum” text cell (green circle) to 0.
When demoing the app, if someone clicks on a meal displaying a total (sum) of 35€, clicking on “Clear” used to enable me to reset this amount to 0€ (because the action performed in the DB was “- Sum Prices”, i.e. “-35€”, and if the sum was 67€ then “Clear” would perform “-67€” in the DB. It would take the Sum of Prices and deduct it from the current Sum of Prices, which equals to 0.
Now, clicking on the clear button (i.e. action “- Sum Prices” in DB) shows a “0” entry instead of “-35€” or “-67€”, which doesn’t reset the total to 0, instead it performs nothing at all.

This function used to work a few months ago, we didn’t update anything and now it’s not working anymore. Adalo’s team couldn’t figure it out. Maybe one of you could?

Action behind the button:

Below, what happens in the DB when clicking on 4 times on “Clear” = enters 4 times “0” instead:

THANK YOU

Do you want to keep the data somewhere in the database, once the clear button is pressed, or do you just want to reset it and don’t mind if the data is retained or not?

Hi! Thank you for your answer.

Yes, a reset could be an option. I don’t need to retain the data.
Do you have an idea on how to do that?

I have a similar setup in my app, where I allow people to test themselves.

In that setup, if they then want to do the test again, without saving any of the data, I can create a button to which an action is added to “create” → “select [the right] collection” and then leave all data empty in the collection. Unless you would like to link it to some ID or user.

Also add a link to the button so the user goes back to the right screen again, to make sure you start over. If this is not possible, first link to a blank screen and then add an action on that screen to link to the final destination.

Finally, if this procedure keeps storing IDs and rows in your collection, you can also add an action to the button to delete the ID (just make sure this action is second, before the ‘linking’ action.

I hope this helps, if not, please share some more info about the screens you have in your app and the structure of your collections.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.