I'm trying to log the RFID Tag ID to a database after printing a tag. I am using a Zebra ZE500R.

What I originally wanted to do was first read the Tag ID in 1 command, then send another command to write to the RFID and the tag label. But if I understand correctly this cannot be done in separate ZPL commands.

I've been trying to get it all to work in 1 command but have been unsuccessful so far.

I can send a ZPL command to read the Tag ID, and it works nicely.

I can also do 1 ZPL command to write to the label and RFID successfully.

The problem comes when I try to combine the two scenarios. The label prints, but with void all over the label indicating the RFID operations failed.

Here is the code I'm trying. (I've removed most of the graphic to make it shorter)