The Conditional Connector Editor makes it easy to add new conditions, create new groups of conditions, change the group type (AND/OR) and remove conditions. The visual display makes nested conditions obvious without you having to understand the boolean logic behind it.
Adding a Condition
To add a new condition to a conditional connector:
- Select the Conditional Connector icon on the toolbar, then drag a connection from the input filter to the destination component. Alternatively, right-click a standard connector, then select Add Condition.
- A new connector is created. Click the no conditions set link that is part of the new connector's label.
In the Edit Conditional Connector dialog, in the Description field, enter a description for the condition. The description is optional and if provided is displayed in the Route Editor as a hyperlink. If a description is not provided, Rhapsody IDE carries out a simple serialization on the configured conditions and generates a pseudo-code description.
- Click the Add new condition, Add grouped condition or Add condition to group link to create a new condition.
- In the Condition Type field, select how you want Rhapsody to filter the messages – by using a message type, a message property, a field within the message, or a message body. The condition parameters you have to enter vary according to the type of condition you select:
- Click the OK button to add the condition. If you clicked the:
- Add new condition link and there are no other conditions, the new condition is added as the first condition. If there is at least one existing condition, a new group is created and the new condition is added as the last condition in the group. The new group is created as an AND group, however, you can change this by clicking the Switch to OR link.
- Add grouped condition link, a new AND group is created, and the new condition is inserted as the last child in the group.
- Add condition to group link, the new condition is inserted into the existing group at the location where the link is clicked. No new group is created in this case.
If you have more than one condition, you can reorder the conditions by dragging and dropping them.
Alternatively, to copy a condition to a conditional connector:
- Select an existing conditional connector and copy its condition by selecting Copy option in the right-click menu.
- Create a new conditional connector (or standard connector) as required.
- Select the new connector and paste the copied condition onto the connector by selecting the Paste option in the right-click menu.
Any test messages associated with a conditional connector are not copied using this method. The test messages are stored in the source filter.
Filter Messages using a Message Property
Field |
Description |
---|---|
Message Property |
Select or enter the name of a message property. This field lists all the properties published by the filters and communication points on the route, and extracted from the message using route property extraction. |
Operator |
Select a comparison operation. |
Operand |
Enter a literal or Rhapsody variable. If the operator is set to Rhapsody variables can be entered manually, for example, If the operator is set to If the operator is set to
|
Filter Messages using a Message Type
Field |
Description |
---|---|
Operator |
Select an operation: |
Message Type (not labeled) |
Use the checkboxes to select the messages you require. If there are multiple definitions on the route, then each definition is displayed in a separate tab. |
Filter Messages using a Field within the Message
Field |
Description |
---|---|
Field Path |
Click the Select Field link to select the field path. The Field Selection Dialog uses the definition attached to the route, therefore the Select Field link is not available if there are no definitions on the route. If there are multiple definitions attached to the route, first select a message definition, then select a field using the messages from that definition. For filtering messages using repeating fields, you can use the wildcard operator to set the field path. This results in the connector performing operations on a comma-separated list of values of all the repeating fields that match the field path. For example, setting the field path in a Conditional connector to |
Operator |
Select a comparison operation. |
Operand |
Enter a literal or Rhapsody variable. If the operator is set to Rhapsody variables can be entered manually, for example, If the operator is set to If the operator is set to
|
Filter Messages using a Message Body
Field |
Description |
---|---|
Operator |
Select a comparison operation. |
Operand |
Enter a literal or Rhapsody variable. If the operator is set to Rhapsody variables can be entered manually, for example, If the operator is set to If the operator is set to
|
Group Types
Rhapsody supports two types of condition groups.
- AND groups - where the individual conditions are combined using a boolean AND operator.
- OR groups - where the conditions are combined using a boolean OR operator.
All new groups are initially created using the AND operator. However, you can change this by clicking the Switch to OR link. You can revert to using the AND operator by clicking the Switch to AND link.
Converting Conditional Connectors
For more fine-grained control, the IDE provides an option to convert your conditions to JavaScript. This is done by right-clicking a conditional connector, and selecting Convert Condition To JavaScript.
Selecting this option carries out a one-way conversion from the conditional connector to a JavaScript connector, and is only available when connected to an engine supporting this functionality. If you choose to convert to JavaScript, the following dialog is displayed:
- Convert - converts the conditional connector to a JavaScript connector.
- Copy - copies the JavaScript to the clipboard instead of changing the existing connector.
- Cancel - cancels the conversion.
Non-existent or Empty Fields
All conditions that test the value of a field, whether they are negative or positive conditions, first implicitly check whether the field value actually exists. If the field does not exist or is empty, then the condition is false regardless of what the condition is.
This can lead to counterintuitive results if the condition is a negative condition.
It is recommended you test your conditional connectors when you create them. Refer to Testing Conditional Connectors for details.
Consider the following scenario:
- P is the positive condition: "Field F starts with 123".
- N is the corresponding negative condition: "Field F does not start with 123".
The conditions evaluate as follows:
Field Value | Result of P | Result of N |
---|---|---|
1234 | true | false |
5678 | false | true |
[Field exists but is empty] | false | false |
[Field does not exist] | false | false |
In other words, if a condition is true, then the inverse of the condition is always false. However, if a condition is false, then the inverse of the condition is only true if the field exists and has a value - it is false if the field does not exist or is empty.
Date-time Operators
Date-time operators take the following form:
Condition Parameter | Description |
---|---|
Date Format | The standard defining the date-time format:
|
Date | The reference date for comparison. Select the Use the current date at time of comparison checkbox to set the Date parameter automatically to the current date-time of the Rhapsody system. |
Range | The date range for comparison, in a user-defined unit of measure, beginning (After ) or ending (Before ) with the reference date. |