Changing more than one table field with a counting parameter

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

Any ideas on this guys?

Yes, you would “update a list of things”. That list is out of stock orders for this type of bag.

Sort the list of orders on order number (or whatever order you want to fulfil the orders in) and then limit that list using :items until = the number of blue bags that have come in.

So you would pick the first two orders

This topic was automatically closed after 70 days. New replies are no longer allowed.