The expression editor is what comes closest to actual code in WEM. The expression editor can be used to create conditionals, make decisions, calculate values, create the logic for different components or fields, and create filters.
This is a field that is used for an expression:
The expression editor will open in a new window in the modeler as you click on the field. The new editor window is shown below.
The expression editor has a few important components. In the top right you can control the size of the editor and make it full screen or close it without saving the changes. When you change or add content in the expression editor you have to close it with the green "Ok" button so it is saved. If you choose cancel, you remove the changes and go back to the original. When closing the editor the expression is checked on its validity. If the expression is not valid, a pop up appears asking if you want to save anyway.
With the validate button your expression is checked on its validity and whether the right data types are used. When an expression is valid a green bar appears on the bottom of the editor. When an expression is found invalid a red bar will appear with the reason and the location of the failure.
The show functions toggle on the top right of the editor is where you find a library with every function, keyword and operator you can use in the editor. The functions are sorted in categories by use-case and have a dot as icon if its a value instead of a function.
When a function is selected, an explanation field appears on the bottom. Here you find the syntax of the expression with the datatype of the parameters and a short explanation of what the function does. When a function has different forms with different parameters, you can switch between versions with the arrows below the function syntax. This will give you the new syntax and a new explanation. The question mark on the right is a hyperlink to the documentation of this function, where you find a more complete explanation with examples.
You can directly use the functions from this list by double clicking them. This will place the function with syntax in the editor.
In the editor you can make comments or disable certain parts of your expressions with the use of the /*
tag. When a text or function is a comment the editor completely ignores it. To start a comment you use front slash followed by a star /*
, to end a comment you use the star first followed by the front slash */
. When you want to comment out everything from a certain point you can use just the start of comment tag without closing it.
More information about the expression editor functions, keywords, operators and data types can be found in our documentation on the WEM Expressions reference.
When a field or list from the datamodel is used you can use ctrl+click to navigate directly to that field in the datamodel.
Modeler | Description |
---|---|
This is text without a function in the editor and will not be recognized.
This is text with double quotes around it. This can be used for labels.
This is a data model field. The square brackets are used to classify it as data-field.
Data-fields can be dragged onto the editor if you want to use the field in the expression. Furthermore, you can locate a field in the datamodel from the expression editor through a Ctrl-click on the text in the editor.
This is a concept field., which can be recognized by the single quotes. In the text, the parent is the first single quoted word and child the second, separated by a period.
Functions are shown in blue. Its syntax and parameters is in parentheses, when you add the function trough the function library.
There are also values which are static. You can find these in the function lists, and will be shown in grey in the editor.
Keywords are also shown in blue (same as functions). The parameters are shown in black text when the keyword is added from the library.
Operators are black. The parameters are shown in black text when the operator is added from the library.