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.