Business Rules 10.7 | webMethods Business Rules Web Help | webMethods Rules Development Help | 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 Problems view, and in the Rule Verification view 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 an expression:
1. For decision tables, execute steps 1 to 3 as described in Adding a Condition Value or Result Value. For decision trees, execute steps 1 to 3 as described in Modifying Condition Values or Assignment Result Values. For event rules, execute steps 1 to 3 as described in Adding a Result Value.
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 theType 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 or by right-clicking it and selecting Move right from the context menu. 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.
b. Right-click a function and select Move right from the context menu.
c. Enter the function manually in the Enter Function Call field.
6. To specify the input parameters of the function, do one of the following:
a. Select a parameter element from the list in the pop-up window that opens after you selected a function. The list contains input and/or input/output parameter references whose types are compatible with the argument selected for the function.
b. Click the Parameters tab, expand a parameter in the list and select 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 function argument, an error will be displayed.
c. Enter the input parameters manually in the Enter Function Call field.
Note:
To specify an empty string as input parameter, enter "".
7. To chain functions, enter the period character after a function and select a second function by double-clicking it in the pop-up window that opens after you typed the period character. For more information about chaining functions, see Working with Expressions.
8. To nest functions, enter a function instead of an input parameter. 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. To insert a date/time value within an expression, place the cursor where you want the date/time value to be inserted. Click the calendar icon on the right side of the Expression tab toolbar. In the pop-up dialog, select a date and time from the calendar and clock controls. Click OK. The date/time value is inserted in the cursor position.
12. Click OK.