Zebra printing - Syntax for inserting variables and/or table records into ZPL code

Hi all,

Looking for some assistance on Zebra label printing in Tulip.

I am able to connect to and print static ZPL code through the player. However, I cannot land on how to use variable or table data in my prints.

I referenced How To Integrate a Zebra Printer with Tulip and used it to model my trigger per below:

When I print with the trigger above, I get a proper format with the static data from the ZPL code chunks but the variables themselves fail to appear. Instead, the variable names print on the label. See below:

I also tried creating a trigger that puts all the label and variable information in as an expression per the example from ZPL with variable substitution from table record - #2 by pte, similar to per below, but cannot get Tulip to accept the expression as part of the trigger.

Any help on this issue would be greatly appreciated.

-Jon

2 Likes

Hey @nelsonj !

Thanks for the detail here. Happy to help. Moving through my debugging steps:

The Zebra Printer Driver catches errors, but Zebra Printers do not. Is your Trigger throwing an error of some kind? Is this error shown in an in-app Message (“Error executing Trigger”)?

From what I can see with your previous print, it would look like you can successfully connect to the printer, and therefore should be instead getting an Error Executing Trigger.

This error means that Tulip is having trouble parsing your Expression into text. To test this easily, copy that Expression, make a button, and paste the Expression in a “Show Message” trigger on that button. Now, we just have to fix this expression until hammering that button shows the Z-code we want.

The four things I would check here:

  1. The Expression has all its quotes and +'s in order - this looks to be true, because it says “Valid Expression” on the bottom in green.
  2. All the Variables in the expression have a value - if you give an Expression anything that includes a null or empty variable, the entire Expression will become null. Be sure your input Variables actually have something in them at the time that this trigger is running - for example, by using the Debug view.
  3. The DATETIMETOTEXT function you have there is parsing correctly - it looks like it, but again if that becomes null then the entire Expression is null. Test this by pasting that function over in a different Message.
  4. If all else fails, it’s because everything here needs to be of type Text (i.e. a String), and some of these variables are other types (e.g. Number, Datetime, or etc.). I don’t think this is the case, as I think the + already forces everything to be a string, but I may be wrong here.

Let me know if this helps!

2 Likes

Thanks Kyle! This helps very much. I think I have it working now. I’m a little embarrassed to say that I failed to notice the “SAVE” button at the bottom of the expression editor which was why I couldn’t get the expression to load.

One further question though: I see that we can load in data from table records, app info and variables. Are there any provisions for loading in data to the expression editor from app completion data?

Thanks again!

1 Like

I can’t answer the question about completion data, but you can use the ZPL custom widget to preview labels.

I also save the ZPL code to a variable first before printing so it can be saved in the completion data. This makes the label “reproducible” if there’s any question later what the label looked like.

As far as troubleshooting, you have to add it, but you can capture network Zebra Printer errors in a trigger.

3 Likes

Great callout on the custom widget @Richard-SNN. @nelsonj, here are links to the Zebra Printer/ZPL resources in the Library—they could help with future troubleshooting:

1 Like

@Richard-SNN that’s smart on the Zebra Driver error catch - good pick.

@nelsonj good to hear you’ve got it up and running! On your note with completion data -

Completion data is pretty heavily protected, as our regulatory users often reference it as an immutable source of record. Unfortunately, that protection includes that it is inaccessible by apps/app triggers.

I believe this is an existing product request (and if not, I’ll make one), but for now do you have a specific datapoint in mind? Obviously, saving whatever you need to a table (or, dis-enabling the “Clear on Completion” setting on the variable in question) will make something accessible in the future.