Updating balance

Hello everyone ! I am working on drug inventory management app. here is my tables
1 drugs list


2. store where balance is maintained

3. prescription where drugs quantity issued to pt

guys I canโ€™t figure out how to update the balance in store table using values from the prescription tables for individual drugs. so that timely stocks can be updated.
pls help, also suggest if there is other way around !
thank you !

0 3 190
3 REPLIES 3

Aurelien
Google Developer Expert
Google Developer Expert

Hi @naresh_chauhan1
โ€œCurrent Stockโ€ should be calculated.
You may want to remove your โ€œbalanceโ€ column from your sheets, regenerate structure, then add a virtual column โ€œbalance_calculatedโ€

[Initial_Quantity]
+SUM([Related Prescriptions][Quantity])

this worked for me exactly the way I wanted thank you so much
in store table I used Related Prescription =REF_ROWS(โ€œprescriptionโ€, โ€œDrugโ€)
and current stock = [quantity]-SUM([Related Prescriptions][Quantity]) both are virtual column
thanks a lot!

Wouldnโ€™t the [Quantity] have to be -5 in this case? I agree that Current Stock should be calculated. But I wonder what the best way would be to increase the Current Stock and decrease the Current Stock.

Top Labels in this Space