Expression Tags Require Quotes Around String Parameters

Erik Lindqvist3 min read
HMI / SCADAOther ManufacturerTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

An empty string parameter substituted into an expression tag leaves no expression for the parser to evaluate, producing the reported “Syntax Error on Token: ‘End of Expression’ (Line 0, Char 0).” Put quotation marks around the parameter reference when the expression needs a string value.

Why common expression fixes fail

Using toString({param1}) does not solve an empty substitution. Parameter processing replaces the reference before expression syntax is analyzed; if {param1} is empty, the expression can reduce to an incomplete function call. The parser then reports a syntax error rather than a problem with the parameter’s value.

A parameter that works in a memory tag’s Value field or a query tag’s SQL Query does not prove that the same expression is valid in an expression tag. Each property has its own interpretation rules. A value accepted as a string in one property may become part of the expression syntax in another.

How substitution creates an empty expression

When the expression tag processes a parameter reference, substitution can happen before the expression parser checks the result. If the parameter contains text, the substituted characters remain in the expression. If the parameter is an empty string, substitution removes the reference entirely. An expression consisting only of that reference therefore has nothing left to parse.

Quotation marks make the intended string-literal context explicit. For a parameter named param1, quote the reference in the expression, as in "{param1}". With an empty parameter, the expression retains an empty quoted string instead of collapsing to no expression.

Diagnostic checks for the tag expression

Check What to inspect Interpretation
Diagnostic message Tag diagnostic for the execution error The cited end-of-expression syntax error points to an expression that is empty or incomplete after substitution.
Parameter value The instance’s value for the referenced parameter An empty string can remove the reference from the expression before parsing.
Expression context Whether the expression expects a string literal Quote the parameter reference when the expression needs text.
Other tag properties Whether the reference appears in Value or SQL Query Success there does not validate expression-tag syntax; diagnose the property where the error occurs.

Expression-tag correction procedure

  1. Open the expression tag that reports the configuration error and locate the parameter reference.
  2. Confirm whether the referenced parameter can be an empty string in the data type instance.
  3. If the expression uses the parameter as text, add quotation marks around the reference. For param1, use "{param1}" rather than an unquoted reference or toString({param1}).
  4. Save or apply the tag configuration, then inspect the tag diagnostic again.

Verification and recurring pitfalls

Verify the correction with the instance that previously produced the error, especially if its parameter value is empty. The tag should configure for execution without the reported end-of-expression syntax error. Also test an instance with a nonempty parameter value so the expression is checked in both substitution cases.

Keep the distinction between syntax and value clear. Quoting addresses the expression parser’s need to see a string literal after substitution; it does not populate an empty parameter or prove that downstream logic handles empty text as intended. If the expression requires a nonempty value, correct the instance parameter or define the application’s empty-string behavior separately.

FAQ

What happens if an expression parameter is an empty string?

Substitution can remove the parameter reference before expression parsing, leaving an empty or incomplete expression. The parser may report “Syntax Error on Token: ‘End of Expression’.”

What happens if I add quotes around the parameter reference?

The expression retains a quoted string literal when the parameter is empty. For param1, use "{param1}" when the expression expects text.

What happens if the parameter works in a memory tag Value field?

That only confirms that the Value property accepts the reference in that context. Expression tags parse the substituted result as an expression, so quote string parameters there.

When should I escalate an expression-tag syntax error?

First check the parameter value and test the quoted string reference. If the diagnostic persists with the corrected expression, capture the exact expression, parameter value, and tag diagnostic, then contact the product’s official support channel.

Back to blog