I hope I’m understanding your problem correctly. It sounds like the idea is that when puller
comes to your list, it pulls ALL entries present, such that the cumulative
value of entries is less than or equal to 8. So if 3 tokens with a cumulative value of 7 are present the puller takes
them all.If there is a single entry
with a value of 2 present, the puller takes it.If the puller becomes a back order, wait until an entry shows up then
pull it.
See the attached model but I’ll explain a bit what it’s
doing because there’s a couple of things here that are not common.For the pullers from the List, they need to
know how “much” they have pulled so far so that our Query can check to see if
there is an entry whose Value will keep the puller under the threshold (less
than or equal to 8). I assigned the amount
pulled so far to a label called PulledToDate, and this label is initialized at
zero right after the source.
Then the Pull from list does two things that are
interesting; the Query Says to pull Where the Value field/label of the entries,
plus the value of the PulledToDate label on the puller is less than or equal to
8.
WHERE (Value + puller.PulledToDate) <= 8
But it only pulls one Entry.The puller will have to loop around and pull again if there are
additional entries that could keep the puller below 8. So after pulling an entry, I update the
PulledToDate label, and go to a decide that checks if there are entries on the
list.If there aren’t, then the puller
is done.If there are, it goes back to
the Pull from List and pulls again.
Here is where it get a little tricky; if there are no
entries on the list that can keep the puller below 8, I don’t want the puller
to become a backorder, so I’m using the Max Idle Timer option to say if the
puller has pulled at least 1 thing so far, then wait for zero amount of time
and release from the Pull activity.This
effectively means that the puller will give up waiting for an entry to pull as
soon as it arrives if no entries satisfy the query.This will also allow a puller that arrives to
the Pull with an empty list, it will properly become a back order and wait for an entry to arrive because it hasn't pulled at least one thing yet. Below is an image of the basic flow:
