I have a table called CUSTOMER-ORDERS that has a list of the orders we receive.
Now some of items are out of stock and our factory make the out of stock items but not always in complete numbers.
So on the attached photo you can see two of the three blue bags are out of stock.
When I get let’s say two bags made how can I update these records to instock? yes but only for as many bags we have made. For example if we have three orders with blue bags that are out of stock and we receive two bags from the factory is there a way to update the first two only orders with blue bags out of stock, almost having a counter or something…
So basically, we have received x bags and z bags are out of stock.
For 1 to x
Loop do while x>0
Find first order where the bag we received from factory is out of stock
Change the status of that order to Instock
Reduce x to x-1
If x>0 go back to begining of loop.
If not exit loop