Welcome!
This community is for professionals and enthusiasts of the Genio platform.
Share your questions and challenges, and help your partners!
Automatic filling of a logical field type
Hello,
Taking into account the sales management system of a sports store, how is it possible to obtain an automatic completion of the column "vendido" (meaning, "sold") in the following table, based on the sales records of each item?
The sold items are already automatically recorded in the following table, whenever a sale occurs.
Thank you for your attention
Hi,
It's not clear in your model if one instance of your product ('Artigo') represents a generic item that will generate multiple sells or if it's meant to be a representation of an individual item and it's unique (and therefore can only be sold once).
If the first is true, you might need to add a stock management, where sales decrease and supplies increase stock values, so that you know when it's 'sold out' (stock equals zero).
If the last is true, the formula that counts related records (SR) from related tables applied directly to the 'sold' field will grant what you need ([SALES->1]).
Hope this helps,
Its probably more informative to know how many times an item has been sold. You can achieve that easily by adding a new related sum field to the 'Artigos' table. Call it 'NumSales' for example. You should use a 'Related Sum' type of formula and count the number of rows of 'Sales':
[SALES->1]
If you want to have boolean notion of each item having been sold or not you can then set the 'Vendido' field as an 'Arithmetic' formula based on the value of the previous field:
iif([ARTIG->NUMSALES]==0, 0, 1)
But this might be a bit redundant now that you have a count of the number of sales.
Keep Informed
About the Community
Question tools
Stats
Asked: 14/2/2020 下午12:13 |
Seen: 1648 times |
Last updated: 17/2/2020 下午4:33 |