Software AG Products 10.7 | Designing and Implementing Business Process Models | Working with Business Rules in My webMethods | Working with Expressions | Adding an Expression
 
Adding an Expression
You can assign an expression to a decision table condition, a decision table assignment result, a decision tree condition, a decision tree assignment result, or an event rule assignment result. Expressions are automatically verified as they are added. Problems appear in the Rule Project Verification window in the Syntax category.
Note:
Escaping is supported. A typed in value such as \n is interpreted as a single new line character.
*To add a function:
1. For decision tables, execute steps 1 to 4 as described in Adding a Condition or Result Value with the Editor. For decision trees, execute steps 1 to 3 as described in Modifying Condition Links or Assignment Result Nodes with the Editor. For event rules, execute steps 1 to 4 as described in Adding a Result Value with the Editor.
2. In the [Value Type] Modification dialog box, select an operator as specified in About Condition Operators (for decision table conditions), About Result Operators (for decision table assignment results), About Condition Operators (for decision tree conditions), About Result Operators (for decision tree assignment results), or About Result Operators (for event rule assignment results).
3. Select the Expression tab. There are two sub-tabs for entering functions and parameters. To filter the functions by the data type of their return values and source elements, select a data type from the drop-down list in the Type select field. To filter the functions by filter text, enter the filter text in the input field below the Type select field.
4. A function always operates on the parameter element that was specified for the condition or result (default). You may specify a different source element for the function by selecting a parameter element that is used within the decision entity or by selecting a function that returns a value of a compatible data type. To specify a different parameter element as source element for the function, click the Parameters tab, expand a parameter in the list, and select a parameter element. Move the parameter element to the right by double-clicking it. Insert the period character as separator after the parameter element name. To select a function to be provided as a source element to another function, see Step 7.
5. To select a function, do one of the following:
a. Double-click a function. If the function has input parameters, the Function Argument dialog pops up. Specify the input parameters as described in Step 6, and click OK.
b. Enter the function manually in the Enter/edit expression field. Press CTRL+SPACE for auto-complete.
6. To specify the input parameters of the function, do one of the following in the Function Argument dialog:
a. Enter a literal value.
b. Select a parameter element from the list in the pop-up window that opens after you click . The list contains input and/or input/output parameter references whose types are compatible with the input parameter selected for the function. After you close the dialog by clicking OK, the input parameter is inserted in the Enter/edit expression field, where you can modify it. To add a parameter element, select the input parameter you want to replace with the parameter element in the Enter/edit expression field, click the Parameters tab, expand a parameter in the list, and double-click a parameter element. The list contains all parameters and their elements that are used in the decision table or event rule regardless of their data type. If the data type of the selected parameter element is not compatible with the data type of the input parameter, an error is displayed.
c. Enter the input parameters manually in the Enter/edit expression field inside %” “%. Use the syntax as described in Working with Expressions, Syntax Overview.
Note:
To specify an empty string as input parameter, enter "" in the Enter/edit expression field, or select EMPTY STRING CONSTANT from the parameter picker in the Function Argument dialog.
7. To chain functions, do one of the following:
a. Enter the period character after a function, press CTRL+SPACE. In the pop-up dialog, double-click a second function.
b. Enter the period character, select the Functions tab, and double-click a function in the list. In the Function Argument dialog, enter the input parameters and click OK. For more information about nesting functions, see Working with Expressions.
8. To nest functions, enter a function instead of an input parameter in the Enter/edit expression field. The return value of the inner function then serves as input parameter of the outer function. For more information about nesting functions, see Working with Expressions.
9. To perform mathematical operations on the return value of functions or parameter references, place the cursor where you want the operator to be inserted, and type it in. The mathematical operators +, -, * and / are supported. For more information about performing mathematical operations, see Working with Expressions.
10. To nest sub-expressions in parentheses, place the cursor where you want the open parenthesis to be inserted, and type it in. Do the same for the closed parenthesis. For more information about nesting sub-expressions, see Working with Expressions.
11. Click OK.