Hi. I have two tables named tblItems and tblReport, and I'd like to replace the data of tblReport with tblItems so I could see the comings and goings of a specific item.
tblItems has fields Date, Item, Quantity, and Status. Status is either "I" for incoming, or "O" for outgoing. Quantity represents the number of items incoming / entering warehouse, or outgoing / leaving warehouse.
tblReport has fields Date, Incoming, and Outgoing. Both Incoming and Outgoing fields are number types.
What I wished to do was to generate a summary of movement of a specific item, for example "ballpen", from tblItems, then copy the Date to tblReport where there was an entry of "ballpen".
Data for Incoming and Outgoing fields would depend on the Status: if the Status is "I", then Quantity of tblItems would be copied to Incoming of tblReport. If Status is "O", then Quantity would be copied to Outgoing. tblReport for "ballpen" would look like this:
[tab]DATE[tab][tab][tab]INCOMING[tab][tab]OUTGOING
[tab]01/15/20[tab][tab][tab]10
[tab]01/16/20[tab][tab][tab][tab][tab][tab][tab][tab][tab]2
[tab]01/17/20[tab][tab][tab][tab][tab][tab][tab][tab][tab]5
[tab]01/18/20[tab][tab][tab]10
Does anyone have suggestions on how to execute this efficiently? I was able to get the results I wanted, but it involved creating a cursor, INSERT INTO cursor, UPDATE cursor if Status is "I", UPDATE cursor if Status is "O", then finally INSERT INTO tblReport. This is the only way that I could think of, as I didn't receive any proper training on FoxPro, nor on other programming languages. I only educated myself through reading books from the Internet, and researching in forums.
Thank you for taking the time to read this.
tblItems has fields Date, Item, Quantity, and Status. Status is either "I" for incoming, or "O" for outgoing. Quantity represents the number of items incoming / entering warehouse, or outgoing / leaving warehouse.
tblReport has fields Date, Incoming, and Outgoing. Both Incoming and Outgoing fields are number types.
What I wished to do was to generate a summary of movement of a specific item, for example "ballpen", from tblItems, then copy the Date to tblReport where there was an entry of "ballpen".
Data for Incoming and Outgoing fields would depend on the Status: if the Status is "I", then Quantity of tblItems would be copied to Incoming of tblReport. If Status is "O", then Quantity would be copied to Outgoing. tblReport for "ballpen" would look like this:
[tab]DATE[tab][tab][tab]INCOMING[tab][tab]OUTGOING
[tab]01/15/20[tab][tab][tab]10
[tab]01/16/20[tab][tab][tab][tab][tab][tab][tab][tab][tab]2
[tab]01/17/20[tab][tab][tab][tab][tab][tab][tab][tab][tab]5
[tab]01/18/20[tab][tab][tab]10
Does anyone have suggestions on how to execute this efficiently? I was able to get the results I wanted, but it involved creating a cursor, INSERT INTO cursor, UPDATE cursor if Status is "I", UPDATE cursor if Status is "O", then finally INSERT INTO tblReport. This is the only way that I could think of, as I didn't receive any proper training on FoxPro, nor on other programming languages. I only educated myself through reading books from the Internet, and researching in forums.
Thank you for taking the time to read this.