Free cookie consent management tool by TermsFeed

Expression Editor

Overview

The Expression Editor allows you to write expressions for your Appian design objects.

This editor is available within a variety of objects, including expression rule objects, interface objects, and process model objects.

Elements

The following image highlights the elements that make up the Expression Editor:

Expression Editor

#

Element

Available Actions

1

Toolbar

Learn more about toolbar actions.

2

Editing pane

3

Documentation pane

View documentation for a specific function or expression object.

Process model elements

In a process model, the Expression Editor offers standard editor capabilities like the toolbar actions and auto-suggestions, but this editor also displays key expression elements in the DATA and FUNCTIONS tabs.

DATA tab

The DATA tab allows you to quickly add variables, parameters, and properties from your process model into your expression.

These include:

  • Process variables.
  • Activity class parameters.
  • Task properties.
  • Process properties.
  • Process model properties.
  • Message properties.

screenshot of the DATA tab in the Expression Editor in process model

FUNCTIONS tab

The FUNCTIONS tab allows you to quickly search, browse, and add functions to your expression.

screenshot of the FUNCTIONS tab in the Expression Editor in process model

Edit an expression

To edit the expression, place your cursor in the editing pane. Begin typing to view auto-suggestions, or select an appropriate toolbar action.

As you edit the expression, the Expression Editor displays design guidance when it becomes relevant.

Toolbar actions

The Expression Editor toolbar provides you with a list of common actions that can be used when interacting with the Expression Editor:

The following sections give additional information about some of these actions.

Create constant

The Create Constant action allows you to easily create constants directly from within an Expression Editor.

To create a constant:

  1. Click create_constant icon in the toolbar. The Create Constant dialog appears.
  2. Configure the constant properties.
  3. Click CREATE. The new constant will appear in your expression at your cursor's current position.

Save selected expression as

The Save Selected Expression As… action allows you to quickly move parts of an expression into a new expression rule or interface.

To use this action:

  1. In the Expression Editor, highlight the part of the expression you want to save.
  2. Click save_expression_as icon.

    Note:  This action is only available when the expression you have selected contains no syntax errors and returns one output (for example, lists are surrounded by braces {}).

  3. In the Save Expression As dialog, configure and review the following properties:

    Property Description
    Save As Determines whether to save the expression as a new expression rule or interface.
    Name The name of the new object.
    Description A short description for the new object.
    Application The application where the object should be created.
    Save In The folder where the object should be saved.
    Include in the design library When saving an expression as an interface, makes the interface available in the Design Library tab of the Design Mode palette for easy access. For more information, see Using the design library.
    Display Name The name that displays for an interface you included in the Design Library tab of the Design Mode palette.
    Rule Inputs Displays a grid of the new object's rule inputs. All variables that are used but are not declared in the selected expression are automatically converted into rule inputs. This section is hidden if an expression has no rule inputs.
    Expression Preview Displays a preview of the expression that will be moved to the new object.
  4. Click SAVE.

Once the new object is saved, the previously selected expression is replaced with a reference to the new expression rule or interface, and rule inputs are automatically inserted.

Auto-suggestions

As you modify an expression in the editing pane, suggestions are offered based on what you type. The Expression Editor suggests functions, rules, keywords, constants, data types, or variables that contain the characters you type and match the domain, as follows:

Suggestion Context Example
Functions fn!, a!, or no domain  
Function variables fv! in a function input that has at least one available The a!createUser() function uses the fv!user variable in its onSuccess parameter.
Rules rule!  
Data types type!  
Keywords of a rule, function, or data type Inside a rule, function, or data type When configuring a!textField(), typing lab will suggest label and labelPosition as keywords if typing a keyword at your current cursor position would be valid expression syntax.
Variables local!, ri! (interfaces and expression rules), or rv! (record type)  

When you highlight a suggested option, documentation for that option appears in a tooltip.

SAIL_Expression_Editor_Doc_Tooltip

Selecting a suggested option from the list inserts it into your expression.

Documentation

To view documentation for any object used in the editing pane, place your cursor inside the matching parentheses of a valid expression object (or, for constants, after the object name).

SAIL_Expression_Editor_Doc_Pane

For functions, documentation includes the name of the object, its description, all of its available parameters, and their data types.

For other objects, documentation includes the name of the object and any available object properties. For example, for rule inputs (ri!), documentation consists of the name, data type, and description of the rule input.

Design guidance

Note:  The Expression Editor displays design guidance for all objects except process models and process reports.

While writing your expressions, you may encounter expression design guidance, which are best practice design patterns that you should implement in your expressions. This guidance is calculated in real-time while editing expressions in your objects and when an object's precedents are updated.

Within the Expression Editor, guidance is indicated with a warning warning_icon or recommendation recommendation_icon icon. When possible, the affected part of the expression is also underlined. To see more details about the guidance, hover over the icons within the Expression Editor, or click on the guidance icon within the object header.

See Appian design guidance to learn more about warnings and recommendations, and how to address or dismiss them.

/Expression Editor recommendations

If your expression contains a syntax error, such as a misplaced comma or unmatched parenthesis, a red warning icon is displayed in the top left-hand corner of the Expression Editor. Hover over the warning icon to display a tooltip with details about the syntax error.

SAIL_Expression_Editor_Syntax_Error

Keyboard shortcuts

The following keyboard shortcuts are available when interacting with the Expression Editor:

Action Windows Mac
Close find/replace dialog ESC ESC
Collapse/Expand code block ALT+L COMMAND+OPTION+L
Comment code block CTRL+/ COMMAND+/
Copy CTRL+C COMMAND+C
Create constant CTRL+Click on new constant name COMMAND+Click on new constant name
Create constant dialog ALT+O COMMAND+OPTION+O
Cut CTRL+X COMMAND+X
Delete group before cursor CTRL+Backspace OPTION+Backspace
Decrease indent CTRL+[ COMMAND+[
Delete line CTRL+D COMMAND+D
Format expression CTRL+SHIFT+F CTRL+SHIFT+F
Highlight all occurrences Double-click word Double-click word
Highlight all text inside Double-click parenthesis Double-click parenthesis
Increase indent CTRL+] COMMAND+]
Launch the Query Editor ALT+V COMMAND+OPTION+V
Move cursor before group CTRL+Left OPTION+Left
Move cursor after group CTRL+Right OPTION+Right
Move cursor to line start Home COMMAND+Left
Move cursor to line end End COMMAND+Right
Open find dialog CTRL+F COMMAND+F
Open find and replace dialog CTRL+H COMMAND+H
Open object definition CTRL+Click on object name COMMAND+Click on object name
Paste CTRL+V COMMAND+V
Redo CTRL+Y COMMAND+Y, COMMAND+SHIFT+Z
Select all CTRL+A COMMAND+A
Save Selected Expression As… ALT+SHIFT+E COMMAND+SHIFT+E
Select group before cursor CTRL+SHIFT+Left OPTION+SHIFT+Left
Select group after cursor CTRL+SHIFT+Right OPTION+SHIFT+Right
Select previous occurrence SHIFT+ALT+Left CTRL+OPTION+Left
Select next occurrence SHIFT+ALT+Right CTRL+OPTION+Right
Show/Hide indent guide CTRL+G COMMAND+G
Undo CTRL+Z COMMAND+Z
View domains SHIFT+ALT+D COMMAND+SHIFT+D
View functions SHIFT+ALT+F COMMAND+SHIFT+F

Feedback