Palletizing with condition

My workpieces are PCBA, they are on trays.

I have a vision system to monitor the presence of the PCBA.

I just tried to set up the Universal robot palletizing.

The idea is to have the robot go to the tray PCBA locations (if PCBA in there is available, then pick up. If not, then go to the next available one)

I tried to put a IF statement into the Pallet sequence but UR does not allow me to do so. How should I proceed?