Hey @MikelST, with regards to the model you posted, there are several problems I see that will hinder your desired functionality. Firstly, you check the subnodes of a "Rack2", but there is only a "Rack3" and "Rack4" in your model. If you're trying to use "Rack3", then you have another problem when checking to see if the subnodes.length is == 14; Rack3 can only hold up to 12 of the items you are producing (due to their size). I suggest increasing the size of that Rack to hold more items.
As for your if/then statement, you can implement that in a Trigger. After clicking on Rack3, look in the Properties panel on the right of the screen; at the bottom there is a section called "Triggers". Here you can put custom code when an event happens on this Rack. I suggest you add two triggers: an OnEntry trigger and an OnExit trigger.

In the OnEntry trigger, click the green + button and go to "Control > Close and Open Ports". You can have the Rack close its input port after it reaches 14 boxes. That way it can't take in any more items.

You'll do a similar thing on the OnExit trigger, where you open the input port once the rack's subnodes.length is less than 9. That way it will take in boxes again. Just to be safe, we can also check if the input is currently open so we don't try to open it repeatedly. Your condition might look like this:
current.subnodes.length < 9 && !inputopen(current)
After fixing all the names (no calling Rack1 or Rack2 since they don't exist) and adding this logic, it seems to work as intended.