Expression Editor
Quick Start
What is the Expression Editor?
The Expression Editor is available everywhere that you use an expression.
- 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 expression
- Click 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 add 1 to a variable called amount and return the result. Properties of variables are referred to using the dot notation e.g.
Functions are operations that can be performed on another operand e.g.
Operators
Operators include:
Operator |
Description |
+ | 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.
When strings are mixed with numbers the numbers are added until the first string is encountered. Thereafter operands are concatenated e.g.
String manipulation
Use functions like SubString, Trim, ToUpper, Split etc. to work with string variables e.g.
String formatting
Use FormatWith to create a string from several different inputs. The above csv sample can be built as
The numbers inside curly braces refers 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.
Date operations
Format a date:
Return the month:
Boolean expressions
In properties where
A Linx boolean type can only be populated with
Example:
When using the Expression Editor to check the value of a boolean, for example in an IfElse function:
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.