The Expression Editor allows you to edit field definitions when you define a process or service connector.
You can open the Expression Editor from Process Designer in two contexts:
•When you select Formula as the Source type for a field definition so you can get the field value from a formula.
•When you define the URL, parameters, or HTTP headers for a service connector.
Expression Editor allows you to:
•See syntax highlighting for XML and XQuery.
•View syntax validation feedback.
•Select code completion options that appear as you type.
•Insert common code fragments from a drop-down list.
•Use keyboard shortcuts.
•Choose fields from a list of available input, output, or temp fields defined for the process, the current step, and any upstream steps in the current process. When you choose a field, the appropriate value (for example, '$input.Customer') is inserted into the editor.
•Choose a function from the list of available functions, grouped by category. The list includes some common XQuery functions and displays syntax help as a tool tip, when available.
•Insert the sample XML representing the selected item (for a process object xml element or for a child of a process object).
•Insert common code fragments from a drop-down list.
Note: The Expression Editor in Application Integration comes with powerful functions that can invoke operating system features. You must review the contents passed into the functions before using them.
Opening the Expression Editor
Where available, click the f(x) icon to open the Expression Editor.
For example, in an Assignment step, you might add an input field with a Formula as the data source. You can select Formula from the list, as shown in the following image:
After the Expression Editor opens, you can use the features described below. The field type and name appears in the window title, as shown in the following image (input.TestInput):
When opened from a service connector, you can choose a type (XML, XQuery, JSON, or Content) and see the fields available in the Connection Properties and Input Parameters, as shown in this image:
Editing Options
When using the Expression Editor, you can use the toolbar and/or the following keyboard shortcuts, which are available when the editor is active (the cursor is blinking):
Undo
Ctrl+Z
Redo
Ctrl+Y
Copy
Ctrl+C
Cut
Ctrl+X
Paste
Ctrl+V
Find
Ctrl+F
Indent four spaces
Tab
Show list of available variables
$
Show list of available insertions (namespaces, functions, fields and common code fragments)
Ctrl+Space
(You can also start typing in the editor to filter the list and select the function or variable you need.)
You can also expand the editor window to full screen using the toolbar icon. Click Esc to close the full screen editor and return to the canvas.
Building a Formula
To enter a formula that determines the value for the selected field, you can access these options from the toolbar:
•Insert Field. Shows the list of available fields you can insert into the formula.
•Insert Function. Shows the list of available functions.
•XML Object. Shows a list of XML objects, if any, that you can add.
For example, in the following image, the Insert list shows the field names associated with the object:
Choose Functions to show a list of those available, sorted by category.
Use the XML Objects list to add an XML code snippet for the field when you are defining a process object. For example, you might create an XML snippet to represent a process object and then use Insert Field to add the input field as shown in this image:
To get more information about a function, hover over the function name in the list to display a description. For example:
Note the following tips when you work with the editor:
•Press Ctrl+Space to display a list of available insertions (namespaces, functions, fields and common code fragments).
•Press $ to display a list available functions, process fields and any locally declared XQuery variables.
•If the expression is used in XML, be sure to add braces around it, for example:
<Value>{2*fn:abs($input.In)}</Value>
•Enter a few characters to filter your list.
Syntax Validation
As you build a formula, the syntax is validated. If an error is detected, a red X appears next to the line that contains the error. Hover over the error indicator to display a description of the error:
As you type, the syntax is validated and the Expression Editor displays a message if it encounters an error condition.
XQuery error messages are defined by the XQuery engine. You can learn more about XQuery validation and see a list of XQuery error conditions (in Appendix F) here: http://www.w3.org/TR/xquery-3/.