Hi,
I would like to know how I can add and subtract values from existing records in the database.
Imagine a sales system, which is necessary to add and remove products from stock.
Thank you,
rafa
Hi,
I would like to know how I can add and subtract values from existing records in the database.
Imagine a sales system, which is necessary to add and remove products from stock.
Thank you,
rafa
Anyone has any ideia?
@rafa.ntt if your data types are set to number you’ll be able to perform the math functions.
But your question is very broad to give a definitive answer, can you elaborate your use case and show screenshots if possible?
Hi Rafa,
When you’re interacting with collection records in Adalo, as long as the information is “available” on your current screen, you can use actions to update the record.
For instance, when a user checks out, you can do CurrentInventory - OrderTotal as a function to update the CurrentItem CurrentInventory record
I will give an example:
TABLE STOCK:
PRODUCT QUANTITY
product_1 3
product_2 10
TABLE SALES:
PRODUCT QUANTITY
product_1 1
product_2 2
FINAL RESULT IN STOCK TABLE:
TABLE STOCK:
PRODUCT QUANTITY
product_1 1
product_2 8
When you confirm a sale, add an action to update the Table Stock values qty = current qty - sale qty.
When you are confirming a sale:
You can have a hidden input field (called “Current Stock”) with format of “number” with a custom formula that has the current stock - "The quantity of that product in the cart).
When paying/confirming, you should have a custom action that will update that product stock using the “Current Stock” field
But it all depends on how you built (Or moment you want the stock to be updated), the checkout screen.
This is a very rough idea using a inventory form not a checkout, but the idea is there. Hope it is helpful.
Thank you.
I´ve been trying your tip, but when I try to do the formula field, I just find the quantities like this below … Sum, Average …
I must be doing something wrong …
Hi,
Is “Produção” where you add all products to submit the record? I would need to see how you built the screen to do the inventory updates.
Yes, “Produção” is where I add the products in the Collection Products, and at the same time should change the inventory Collection.
COLLECTIONS:
Products:
Inventory:
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.