Hi @Byron H2, the key here is allowing the combiner's target quantity to change based on the Queue contents. I basically record the queue's contents each time boxes exit the queue. If this content drops below 30, I update a global table with the leftover amount. The combiners then read from this table to determine how many boxes to pull for each batch.
To do this, I first create a global table with only one row and one column. On Queue1's 'on exit' trigger, I select 'Write to GlobalTable." I added some code here to change the value depending on the queue's contents which you can see below (the -1 comes because the box leaving which triggers the event is still technically in the queue even though it's about to leave).
Next, I add a label to the pallets coming in called "Type" and set the value to 1 (this is just for the combiners to read from the table we created above). I use an 'on entry' trigger for the combiners and select "Update Combiner Component List." This asks for the name of the table and label. The label value is looking at the label on the pallet. It determines which column will be used to set the target quantity. Since we are only using 1 column, the Type label was set to always be 1.
No matter what your initial value of cookies are, the combiners will always bake in batches of 30 until the last batch when it will just bake the leftovers.
question-EM.fsm