Skip to main content
Writing Expressions
Lucas Tran avatar
Written by Lucas Tran
Updated over a year ago

What is an expression?

An expression is the sequence of words and characters that will perform a particular function for the label during printing or rendering. Some functions are pulling data from a screen, static words, adding images, etc.

Understanding Expression Types

There are 6 expression types with each having its own purpose and uses.

The 6 expression types are:

  • Fixed: The fixed type refers to any expression that is static. For instance, a string or sample value. These fields will always keep their same value.

  • Screen: The screen type refers to dynamic fields that pull their data from the respective screen that the model is mapped to. These fields will change depending on the data found in your system.

  • Function: The function type refers to the use of ZPL functions to implement the expression.

  • Content: The content type refers to the mapping of Content to the expression. Typically this is used when there is a 2D barcode that contains different identifiers.

  • Image: The image type refers to the use of an image on the label.

  • Snippet: The snippet type refers to a call of a snippet to be placed on the label.

  • Same: The same type means that the expression has the same type and words as the previous column (previous expression).


Writing Expressions

Fixed Expressions

Select the Fixed expression type in the Expr. Type column. The Sample Expr. will auto-assign Same as the sample expression will be used in the rendering of the label. In the expression, column write any words or characters that you wish to have on your label.

Screen Expressions

Select the Screen expression type in the Expr. Type column. Writing an expression that is pulling data from a screen can be done in two ways:

Method 1: Tree Selector

When the Screen expression type is chosen, a tree selector will be available in the expression column. The tree contains all the possible variables and data that can be used for your label. The selector only displays the 1st level, however, if there is a plus sign next to the variable, you may need to go to the DAC schema to find the 2nd level to get the proper data point. To select, simply double-click on the field desired.

  • An example of a 1st level data field is transactions.LotSerialNbr

  • An example of a 2nd level data field is Document.VendorID.AcctCD

Method 2: Element Properties and DAC Schema

Method 2 is going to the screen and using the inspect element feature to find the Data Field. This method is also used to find the 2nd level data field.

  1. Inspect element (Ctrl + Alt) > Click on a Data Field

    Expected result: Element Properties popup menu will appear.

    Notice: The 1st level is found by joining the View Name and Data Field together by a "." You can stop here if all that is required is the 1st level.

  2. Click on Data Class. This will open the DAC Schema where you will be able to see all the data field in the Data Class

  3. Locate the desired Data Field. Can be found faster by doing Ctrl + F.

  4. In the Foreign Reference column, click on the data class that is in the reference (i.e., InventoryItem). This will open the DAC Schema for the foreign-referenced DAC

  5. Look for the primary key of the DAC, the primary key (denoted by a gold icon) will be the data field used for the 2nd level of the 1st level data field.

Expected Result: The final expression will be transactions.InventoryID.InventoryCD.

Function Expressions

Functions are methods that can be used to combine, or format screen expressions together or pull a value from a current date. For instance, using the date.Now function will pull the current date and time. Using the following expression will concatenate the words together: ['A','-','Keurig Model 450'] will yield A - Keurig Model 450

Content Expressions

Content expressions are expressions related to 2D barcoding. To map a content expression you do not have to write anything in the expression column. Simply select the ContentID desired from the column of the same name and select the Barcode desired from the BarcodeID column.

Image Expressions

The image expression type allows you to place an image on your label. To map an image, you select the image you want to use from the selector in the Printer Image column.

Snippet Expressions

Snippets are reusable sections of a label. Once a snippet has been defined and created, you can map it to an expression code. In the expression column, all the available snippets can be chosen from the selector

Same Expressions

Nothing needs to be configured in the same expression type because it will pull whatever is written in the previous expression and use it as its own value.

Did this answer your question?