The Expression Editor
Working with expressions in KnowledgeKube is primarily done using a specialised interface known as the Expression Editor. This can be accessed from anywhere in KnowledgeKube relating to expressions.
For example, when working with a question type that requires an expression—such as a Button or Form Expression—you can access the question's Properties tab and click Edit Expression.
The expression editor is usually accessed via a button next to an expression text field. This button is commonly marked with an ellipsis (...) but this can change depending on the area.
The expression editor itself consists of three tabs. The first of these is Editing Expression, which is where you can make changes to the current expression.
You can split this tab into two or four sections. This can be helpful if you want to work on different parts of an expression at the same time without having to move between them.
To split the tab, click the rectangles in the bottom-left or top-right corner and drag to expand the new view.
The areas to click and drag to split the expression editor.
When you make changes to the expression, the affected rows will be marked yellow. This means that the row has been altered but the changes have not been saved yet. When the expression is saved, the marking will change to green.
Saved and unsaved changes in the expression editor.
One of the most important features of the expression editor is the IntelliSense, which you can access by clicking the Ctrl key and Space bar at the same time.
Using the IntelliSense.
The IntelliSense lets you search for and add Functions to the expression. When you select a function from the list it gets added to the expression and you will be shown the function's syntax as well as other useful information.
Viewing the IntelliSense details for a function.
This tab also contains an expandable menu where you can quickly access and insert keywords for actions, question groups, and data sources. You can open this by clicking the icon in the top-right corner, which will expand the menu.
Viewing question group keywords in the expression editor.
You can switch between the different types of keyword and double-click on one to add it to the expression. You can also click the Peek option above the list to open a new tab with additional information about the selected keyword.
The information here will vary depending on the type of element. For example, peeking at a question group will display the questions it contains as well as its purpose.
In addition to these features, this tab contains several other helpful tools to make it easier to work on and view the expression. You can read about these features in Appendix: Advanced Expression Editor Options.
The next tab is called Original Expression and displays the current expression in the state it was at the point when you accessed the editor. You can use this for your reference and also reset the expression to revert to this earlier version if required.
The final tab is Output, which displays the results when you run an expression in the editor.
For more information on using the expression editor, refer to the following topics:
Description | Further Reading |
---|---|
Test the current expression while working on it in the expression editor. | Running an Expression in the Expression Editor |
Revert to the original version of the expression as it appeared before accessing the editor. | Resetting an Expression |
Add lines of readable text, known as Comments, to expression code. | Writing Expression Comments |
Insert an Expression Snippet into your current expression. | Using Expression Snippets |
Update the appearance of the expression editor. | Changing the Appearance of the Expression Editor |