Expression Builder
Overview
The Expression Builder is used with the Ticket Designer to place objects on the design pallet. This powerful tool lets your objects print plain text, information from fields in the EZScale database, results of calculated fields, and more. The Expression Builder also lets you format your output to suit your needs.
You can only get the to the Expression Builder while designing tickets using the Ticket Designer.

Expression Name
The Expression Name is how your expression will be identified on the ticket design. For example, if you enter "Gross" as the Expression Name, the word Gross will appear as the object name on the ticket design when you close the Expression Builder.
![]()
If you do not enter an expression name, then the Expression itself will be plugged into the Expression Name when you close the Expression Builder. This can occasionally result in a long and meaningless name, so you may want to take the time to name your expressions explicitly. You can always edit the name at any time.
Expression
The actual expression is built in the window just below the Expression Name. You can type the expression manually or use the expression builder tools below the expression to assist you.
To use the expression builder tools, select an item from the list on the left. That will display associated choices in the list on the right. Make sure the text cursor is located in the expression where you want to insert, then double-click a choice from the list on the right. It will be inserted into the expression wherever the text cursor was located.
Tip: If you have multiple characters highlighted in the expression, they will all be replaced when you double-click a choice to insert. You can automatically highlight a complete word in the expression by double-clicking the word. Try it!
Expressions can be simple or very complicated. They can include user entered text and data extracted from the Tickets Query database. Expressions can be the result of logic tests and calculations. You can even concatenate (combine) text, extracted data, calculations and more into a single expression.
Plain Text
If all you want to print on the form is plain text, you have two choices:
You
can leave the expression blank and enter the text as the Expression Name. When the expression is blank,
EZScale prints the expression name on the ticket.
You
can enter the text that is to be printed in quotes ("") in the expression box. For example,
to print your company name on every ticket, you could enter "YOUR COMPANY NAME" as the expression.
Note: You must include the quotes around the text otherwise EZScale will interpret the text a fields in a database and will attempt to lookup the values and substitute the values when you print the ticket.
Fields
You can print any field from the Ticket Query of the database on your ticket. There are two ways to indicate which field you want printed.
You
can manually type the name of the field, or
You
can select Fields in the lower left hand list below the expression. This will display a list of all the
fields in the Ticket Query in the list to the right. Double-click on the field you want to output and
it will be inserted at the current cursor location into the expression.
Functions
Expression Builder supports two powerful functions, IIF and FORMAT described below.
IIF
The IIF function returns one of two parts, depending on the evaluation of an expression.
Syntax: IIf («expr», «truepart», «falsepart»)
where...
<<expr>> is an expression that evaluates to TRUE (a non-zero value) or FALSE (zero)
<<truepart>> is an expression.
<<falsepart>> is an expression.
Below are some example IIF functions:
|
IIF(GrossWt > 60000,"Overload","") |
If the GrossWt for the ticket is greater than 60000, then print "Overload", else don't print anything. |
|
IIF(BalanceDue > 0, "BALANCE DUE","PAID") |
If the Balance Due for the ticket is greater than 0, then print "BALANCE DUE", else print "PAID" |
|
IIF(Inbound = #TRUE#, "INBOUND", "OUTBOUND") |
If the Inbound box was checked for the ticket, then print "INBOUND", else print "OUTBOUND" |
|
IIF(POMaxWtBal < (POOrderedWT * .10), "WITHIN 10%","") |
If the POMaxWtBal is less than 10% of the POOrderedWt, then print "WITHIN 10%", else print nothing. |
As you can see, the IIF provides some powerful capabilities. IIF statements can be nested and the result of an IIF statement can be used as input for another function including another IIF statement.
Format
The FORMAT returns a string containing an expression formatted according to instructions contained in a format expression.
Syntax: Format («expr», «fmt»)
where:
<<expr>> is an expression that evaluates to TRUE (a non-zero value) or FALSE (zero)
<<fmt>> a valid user defined format expression.
The Format function is used primarily to format numbers and DateTime fields.
Click
here for details on Formatting Numbers
Click
here for details on Formatting DateTimes
Constants
Constants are fixed values that can be inserted into your expression by double clicking
Empty String
Inserts double-quotes ("") into your expression. Plain text is always delimited with quotes. So two quotes is the same as a zero (0) length string.
False
Inserts the constant False into your expression. False always evaluates numerically to zero (0).
Null
Inserts the constant Null into your expression. Null represents a data field that is empty or blank.
True
Inserts the constant True into your expression. True always evaluates numerically to minus one (-1).
Operators
Operators include both numeric and string operators that can be inserted into your expression.
- (minus)
The minus (-) operator performs subtraction. This is a numeric operator.
* (asterisk - times)
The asterisk or times (*) operator performs multiplication. This is a numeric operator.
\ (backslash - divide)
The backslash or divide (\) operator performs division. This is a numeric operator.
+ (plus)
The plus (+) operator performs addition. This is a numeric operator.
& (and - concatenate)
The and or concatenate (&) operator performs concatenation of strings. This is a string operator.
For example:
"100" & "50" evaluates to "10050" This is concatenation
where...
100 + 50 evaluates to 150 This is addition
= (equals)
The equals (=) operator performs an equality comparison. This can be a string or numeric operator.
Boolean
The Expression Builder also supports Boolean operations. These are not documented because they tend to be more complicated and raise more questions than they're worth. However, if you understand Boolean logic, the usual operators are supported including AND, NOT, OR, Etc. Boolean expressions can also be used as expressions in the IIF and FORMAT functions.
Example Expressions
Below are just some example expressions you could create with the expression builder:
|
This Expression... |
Prints This... |
|
Format( GrossWt, "##,###.00") |
Gross weight in pounds (lbs) to two decimal points accuracy. |
|
Format( GrossWt, "##,###.00") & "(lbs.)" |
Same as above followed by the (lbs.) units. |
|
Format( TareWt / 2000, "##,###") |
Tare weight converted to tons with no decimal points. |
|
GrossWt - TareWt |
The Gross weight minus the Tare weight. Of course you could just print the NetWt to get the same result. |
|
Format( DateTime, "mm/dd/yy") |
Date that the ticket was processed in the mm/dd/yy format, ex: 10/01/00 |
|
Format( DateTime, "hh:mm:ss AM/PM") |
Time that the ticket was processed followed by AM or PM. |
|
"Total Due = " & Format( BalanceDue, "$##,##0,00") |
Total Due = $120.10 assuming the BalanceDue was say 120.1002 |