Configuring conditions for an ECA rule

This topic describes how to configure the conditions part of an ECA rule for widgets.

Figure 1. The Condition panel of the ECA editor

A condition must be specified for every ECA rule. A condition is the part of an ECA rule that performs a logical test that causes the actions that are defined in the "Actions if true" part of the ECA editor to be carried out if it evaluates to true. If the condition part of an ECA rule evaluates to false, the actions that are defined in the "Actions if false" part of the ECA editor are carried out. For information on how to define actions in the ECA editor for an ECA rule, see Defining actions for an ECA rule.

As shown in Figure 1, the following conditions are available for selection in the Rules tab of the XUI editor:

No Condition

If No Condition is selected, the systems executes the true action by default.

Widget Function

Each widget has a function. The Widget Function option allows you to specify the function that is bound to a widget. In most situations, the widget function returns a Boolean value. The system will then call either a true or a false action depending on the value that is returned.
Note: If you specify a function for a widget, you must click Apply Value in the Conditions panel to bind the function to the widget.

Widget Property

The Widget Property option allows you to configure a condition to the property of a widget. This condition is the same as the Widget Function condition type, there will be a return value. This condition will return two value types : String and Boolean. Usually, system will call true or false action according to the Boolean value. But now there is a string type return value, so how the system calls relative action. Only Boolean type action existed, not String type action. In view of this situation, the system will execute the true action by default, once the condition return value is string type.
Note: After you select a property in the Widget Property panel, you must click Apply Value to configure a condition for the widget property.

Expression

The outer operator is arithmetic, which can include only the following operators in the expression: addition, subtraction, multiplication and division. However, if you select a logical operator in outer expression, logical and arithmetic operators are displayed in the expression.

As an example, you can use an expression in the condition part of the ECA editor if you want to create a rule in which a text box cannot be empty when it is being filled by a user. In this example, you would create a rule in which a text box cannot be empty by doing the following steps:
  1. In the Condition drop-down list, select Expression.
  2. In the Left field of the Expression panel, click the Browse icon. The "Please select a value" window is opened.
  3. In the drop-down list in the "Please select a value" window, select Widget Property. The Widget Property panel is displayed.
  4. In the Widget Property panel, select the text box widget, and then select value. Click OK.
  5. In the Operator drop-down list of the Expression panel, select !=.
  6. In the Right field of the Expression panel, click the Browse icon. The "Please select a value" window is opened.
  7. In the drop-down list in the "Please select a value" window, select Constant. The Constant panel is displayed.
  8. In the Value field of the Constant panel, enter an opening quotation mark ("). Click OK.
  9. In the Condition panel, click Apply Value.

Global Function

A global function is a common utility function that is used for data manipulation, and it returns a number, string, or a Boolean value. As shown in Figure 2, global functions are organized according to the following three categories in the ECA editor:
  • String
  • Dates
  • Numbers
Figure 2. Global functions in the ECA editor
Table 1 provides a description of the global functions that are provided in the ECA editor by WebSphere® Multichannel Bank Transformation Toolkit.
Table 1. Global functions that are provided in the ECA editor by WebSphere Multichannel Bank Transformation Toolkit
Category Function name Description Is server side Is client side
String concat Concatenates two Strings Y Y
length Returns the length of a string Y Y
contains Returns whether a substring is part of a string Y Y
subString Returns a portion of a string Y Y
indexOf Returns the position of a substring Y Y
lastIndexOf Returns the position of a substring starting from the end Y Y
replace Replaces all occurrences of a substring in a string with a new value Y Y
trim Remove leading and trailing blanks Y Y
upperCase Converts a String to upper case Y Y
lowerCase Converts to lower case Y Y
compare Compares two strings lexicographically. Return 0 if string1 is the same as string2, return >0 if string1 is after string2, return <0 if string1 before strings in dictionary order Y Y
compareIgnoreCase Compares two Strings lexicographically ignoring case differences. Return 0 if string1 is the same as string2, return >0 if string1 is after string2, return <0 if string1 before strings in dictionary order Y Y
Number round Returns the closest long or integer to a number Y Y
truncate Returns the truncated value of a number Y Y
absolute Returns the absolute value of a number Y Y
Date today Returns the current date Y Y
dayOfWeek Returns the day of the week Y Y
year Returns the year of the day in number Y Y
month Returns the month of the day in number Y Y
day Returns the date of the day in number Y Y
after Returns the date which is after than a given date with specified(days, months, years) period Y Y
before Returns the date which is before than a given date with specified(days, months, years) period Y Y
daysBetween Returns the days between the two dates in decimal as time in day is taken into account Y Y
natureDaysBetween Returns the nature days between the two dates ignoring time difference Y Y
parseDate Returns date in BTT Date type. 'pattern' argument defines the format (such as 'dd/MM/yyyy') of date parameter Y N
toString Returns date in String. 'pattern' argument defines the format (such as 'dd/MM/yyyy') of return date Y N