Expression Editor
Quick Start
What is the Expression Editor?
The Expression Editor is available in the dropdown of all properties that accept expressions.

Click to open the Expression Editor
System variables that are always available to include in an expression
Functions that are available to include in an expression
Variables that are in scope, and available to include in an expression
The expression
Help on a selected function. (To view help content, click on the relevant function in the drop-down list)
Layout of the Expression Editor

The Expression Editor is composed of the following:
Expression area
Enter an expression or select relevant variables and functions from the available lists to build up an expression.
Variables and Functions
Variables folder
There are 2 categories of variables available to include in an expression:
In-scope variables: Those variables that you have already created upstream within the same function for which you are creating an expression.
Those variables you have already created as Settings.

System folder
The System folder includes system properties and functions.
System properties
CurrentDateTime
NewLine
Null
Functions
Function Help

To view help for a specific function, click on it where it is listed. The Help for the selected function is displayed in the help section.
Test

To test an expression for correct structure and syntax:
Click on the Test tab
Click the Run Test button
The result of the test is displayed
A typical error message is: “Expression contains invalid syntax.”
Note: When testing an expression, usually relevant input has to be provided by the user. If the expression references a result from a function above, a value needs to be provided that will substitute the result in the expression. The test will be executed with that value. If my expression is Integer1 + Integer2
, then the user will be asked to provide two integers in the test tab for the test.
Working with Expressions
Linx uses C# expressions to evaluate values at run time.
Concept
Excel uses expressions in cells. These expressions evaluate to a single value visible in the cell. In a similar fashion, Linx uses expressions when assigning values to properties. Linx expressions are evaluated at run time. Excel expressions use VBA syntax. Linx expressions use C# syntax. Linx expressions in property windows are preceded by a "=".

=
indicates that this is an expressionClick here to open the Expression Editor
Variables available to include in the expression
Variable that is being configured
Definition
An expression is a series of operands and 0 or more operators that evaluates to a single value.
Operand
Operands can be values, names, or functions.
Values are numbers or strings e.g.
123
,"abc"
. Strings are enclosed in double quotes.Names refer to variables available in the scope of the expression e.g.
amount + 1
will add1
to a variable calledamount
and return the result. Properties of variables are referred to using dot notation, e.g.Person.Age + 1
will add1
toPerson.Age
and return the result.Functions are operations that can be performed on another operand e.g.
Person.Birthdate.ToString("yyyy-MM-dd")
will returnPerson.Birthdate
as a string formatted to look like"2016-12-31"
. Functions can be strung together e.g." 123,45 ".Trim().Replace(",",".")
will return123.45
.
Operators
+
Add, Concatenate
-
Subtract
*
Multiply
/
Divide
<
Less than
<=
Less than or equal
>
Greater than
>=
Greater than or equal
==
Equal
!=
Not Equal
&&
And
||
Or
For a full list of C# operators, go here. Linx does not support all the operators.
Things You Can Do
String Concatenation
Strings are concatenated using +
, e.g. "ab" + "c"
evaluates to "abc"
. Build a CSV line with an expression like Person.Name + "," + Person.Surname + $.System.NewLine
.
When strings are mixed with numbers, the numbers are added until the first string is encountered. Thereafter, operands are concatenated, e.g.
"1" + 2 + 3 + 4
will evaluate to "1234"
.
1 + 2 + "3" + 4
will evaluate to "334"
.
String Manipulation
Use functions like SubString
, Trim
, ToUpper
, Split
, etc. to work with string variables, e.g. TextFileRead1.FileContents.Replace("John", "Peter")
will replace all instances of "John"
in the FileContents
variable with "Peter"
.
String Formatting
Use FormatWith
to create a string from several different inputs. The above CSV sample can be built as "{0},{1}{2}".FormatWith(Person.Name, Person.Surname, $.System.NewLine)
.
The numbers inside curly braces refer to the index of the parameter in the FormatWith
part. For larger string formatting jobs, rather use a templating function like RazorTemplateTransform.
Calculations
e.g. AmountExVat * (1 + VatRate)
Date Operations
Format a date: Person.Birthdate.ToString("yyyy-MM-dd")
Return the month: Person.Birthdate.Month
Boolean Expressions
In properties where true
or false
are expected, the expression must return a boolean value, e.g.
Person.Name == "Mary"
(name is Mary)
Person.Age < 10 && Amount > 500
(person is younger than 10 and amount is greater than 500)
Important
A Linx boolean type can only be populated with true
or false
(all letters in lower case). It does not accept any other value or variation of true/false like Y/N, Yes/No, 1/0, on/off, TRUE/FALSE or True/False.
Example:
When using the Expression Editor to check the value of a boolean, for example in an IfElse function:
Boolean == false
.
Functions
Functions in an expression are operations that can be performed on data. Different functions apply to different types of data.
Go here for a list of functions.
Last updated