Alternating between multiple palletizing functions

Hello,

I am trying to implement a program that will pick and place different parts from multiple trays into a single fixture. So far, I have used the palletizing template to get the robot to empty each tray, however, I would like the robot to pick a part from one tray and place it in the fixture, then interrupt the palletizing sequence for one part, switch to the other palletizing sequence, pick and place the second part. My first attempt at this was using a switch with a case for each template and assignments to switch the cases after placing each part, however, this did not work as intended, and the robot just continued on the first pallet until finished. Is it possible to get the robot to work this way using the palletizing template or will I need to write a more complicated script including both palletizing routines in code?

I suspect you do not have the correct logic. It should look something like this.to toggle between two pallets.
Before Start
switch_variable = 1

Robot Program
switch

 case 1
     pallet 1 sequence
     switch_variable = 2

 case 2
      pallet 2 sequence
      switch variable = 1

movements to place part into single fixture