# ZPL | Custom Template : 'null' variables preventing Zebra function operating

**URL:** <https://community.tulip.co/t/zpl-custom-template-null-variables-preventing-zebra-function-operating/2413>\
**Category:** Support, Troubleshooting, & Help\
**Created:** [April 13, 2021, 3:45pm UTC](https://community.tulip.co/t/zpl-custom-template-null-variables-preventing-zebra-function-operating/2413 "2021-04-13T15:45:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/dave/32/439_2.png) [@Dave](https://community.tulip.co/u/Dave)\
**Post date:** [April 13, 2021, 3:45pm UTC](https://community.tulip.co/t/zpl-custom-template-null-variables-preventing-zebra-function-operating/2413/1 "2021-04-13T15:45:51Z")

</div>

Hey folks,

I ran into a ZPL issue today that caught me off guard,  
-Looking to see if anyone can help me wrap my head around this one.

It seems that if a variable is populated with ‘Null’ the device function\_Zebra Printer, Custom Template fails

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/3/349cf43468ff22f38464c017097fe8a2335d69f1.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/5/5ad51147fec6f2e7f16796f26dd25a6084738cff.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/7/769fce2dc72c3f66de4454bd7ec1040f6bed22db.png)

This instance caught me off guard as we have used this button and device function for several months.  
-In the past, if a variable = ‘Null’ the printed material would return a blank field.

* * *

One detail to note is that I was able to identify a difference in the Expression structure of my trigger function:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/f/fdfc4319b2c6bf490a884cbdebc26b90c6ec850e.png)

In the past, I structured the variables within the expression: [AAAA|BBBB]  
-Whereas, when I was surprised to see the structure had been changed to: [AAAA + ’ | ’ + BBBB]  
(I thought somebody rewrote expression at first 👀 )

I am not sure if this change is in consequence to a recent update?  
-Any insight is helpful.  
(I am weighing if I need to create a substantial long-term solution to mitigate this roadblock.)

---

<div class="post-metadata">

**Author:** ![joonhok](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@joonhok](https://community.tulip.co/u/joonhok)\
**Post date:** [April 13, 2021, 4:49pm UTC](https://community.tulip.co/t/zpl-custom-template-null-variables-preventing-zebra-function-operating/2413/2 "2021-04-13T16:49:23Z")

</div>

Hey Dave,

I’m the engineer that worked on recent changes to Expressions. I believe that you were previously using Text Static Values with embedded variables, which allowed you to structure variables within the expression as `[AAAA|BBBB]` as you described. To clarify our product, since it’s unintuitive for variables to be a _static_ value, any Text Static Values with variables in them were automatically moved to be Expressions instead in the latest release 205.

The downside to this, as you’ve discovered, is that a Static Value with a `NULL` variable automatically becomes a blank field, but not for Expressions. I think the simplest solution to have your function up and running again is to enclose any variables that may potentially be `NULL` with the Expression Editor `LINK()` function, described [here](https://support.tulip.co/en/articles/2864695-technical-details-of-the-expression-editor): so instead of `Variable.Selected.custbody54`, you can write `LINK(Variable.Selected.custbody54, '')` so that if your variable is `NULL`, it will default to a blank string like before.

Let me know if this works, and apologies for the inconvenience!

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/dave/32/439_2.png) [@Dave](https://community.tulip.co/u/Dave)\
**Post date:** [April 14, 2021, 1:43pm UTC](https://community.tulip.co/t/zpl-custom-template-null-variables-preventing-zebra-function-operating/2413/3 "2021-04-14T13:43:46Z")

</div>

Hey Joonhok,

Thank you for following up!

I was able to apply the solution you advised and it worked!  
-Thank you very much.

---

<div class="post-metadata">

**Author:** ![pte](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/pte/32/444_2.png) [@pte](https://community.tulip.co/u/pte)\
**Post date:** [April 29, 2021, 12:49pm UTC](https://community.tulip.co/t/zpl-custom-template-null-variables-preventing-zebra-function-operating/2413/4 "2021-04-29T12:49:48Z")

</div>

Hello @joonhok ,

I saw this post and I believe you can help me understand the expression editor.  
“Sometimes” when I add a variable string to a static string the variable is change to e{sequential number}. When it happens I’ve to start from the beginning and add string one by one.

 ![Expression_editor](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/2/22ef0697d70167f6b42a027147a361519f722ef4.gif)

---

<div class="post-metadata">

**Author:** ![seanofandrea](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@seanofandrea](https://community.tulip.co/u/seanofandrea)\
**Post date:** [April 29, 2021, 3:03pm UTC](https://community.tulip.co/t/zpl-custom-template-null-variables-preventing-zebra-function-operating/2413/5 "2021-04-29T15:03:13Z")

</div>

Hello Patxi, Joon is out this week; I’m another engineer on the team.

It looks like the your current issue with e# is related to how the quotes are being used in the expression editor. The short version is that if you replace the single quote at the start and end of the expression with a double quote, it should start working.

The longer version is this. It looks like the expression editor is treating the entire expression as a string literal since it starts and ends with a single quote, and there are no single quotes throughout the body. If you replaced all of the double quotes with single quotes throughout, that would also work. I suspect the reason this happened is because the expression editor automatically replaces pairs of double quotes with pairs of single quotes. So if you are building the expression incrementally and only using double quotes, you might run into this. The more general fix is to always used single quotes when building expressions.
