How to add the sum of related transactions?

  1. I am developing an inventory management app, which wants to show what items are put in each and every location.

  2. I created a transaction table which records all the items, in and out qty, with their respective locations.

  3. When I try to link the location table with the transaction table, the relevant transactions were retrieved. However, the system fail to add the sum of the same items available in the same location. Therefore, i cannot check the total quantity in the location form.

  4. In this example, product โ€œS10150โ€ were added to location โ€œ1L1Aโ€ โ€‹for
    โ€‹2 times each of 100pcs. I wish to show that the available products in location โ€œ1L1Aโ€ are:

  • S10150 = 200pcs
  • S10161 = 100pcs
  • S10184 = 100pcs

May I ask how to do it?

Tables in this app (attributes):
i. Product (ProductID, Product name)
ii. Location (Location)
iii. Transaction (DateTime, ProductID, Location, Quantity_change, User)

I am actually thinking if i should add a virtual column in โ€˜Transactionโ€™ table, namely โ€œtotal_qtyโ€. Therefore, the โ€œtotal_qtyโ€ should equal the sum of โ€œQuantity_changeโ€ if the productID and Location match the row. But I donโ€™t know how to code this.

I would be very grateful if anyone can advise me ><

0 10 461
10 REPLIES 10
Top Labels in this Space