# Dynamc limit in table

Hi!

You need to put some balls in some holes.
You can change the capacity of holes, but the number of balls can’t exceed the limit.

For example, if you set a limit to 9 on Hole 1, I would like the number of balls in the table to be 9 maximum, (8 and 1 in this case) and then send 2, 5 and 8 to the 2nd Hole if it doesn’t exceed the limit set for Hole 2, otherwise send them to Hole 3.

How would you set up this ?

Thanks

Doable … but boy … I would have to put my thinking hat on

Yeah… this is not so easy… and we still have some logic issues…

@jordiboy88001 how are you planning to choose the balls that are going to stay? Because if you set the limit of Hole 1 to 8, you can keep the 8 ball or the balls 1, 2 and 5…

And if you kept the 8 ball. you will keep the first or the second one? Because you have two 8 balls in Hole 1…

I’m probably missing something but it seems like a simple waterfall loop would achieve your objective:

• sort holes by priority
• Loop thru all balls count
• for each ball count and associate it with first hole that has remaining capacity that >= balls count.
• remaining capacity = capacity - sum (ball count in hole)