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
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':
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.
About This Community
|Asked: 2/14/20, 12:13 PM|
|Seen: 105 times|
|Last updated: 2/17/20, 4:33 PM|