If/Else Block
Use the If/Else block to test for a condition and only run certain blocks depending on the results of the test.
For example, you may wish to check if accounts in your source system are still active. If they are active, update the target system, but if accounts are not active, delete them from the target instead. To accomplish this task, do the following:
- Use the If Block’s condition to check active status for the account in the source data.
- Place an Update Block in the If clause to update the target data from the source data.
- Place a Delete Block in the else clause to delete inactive accounts from the target data.
Using The If/Else Block
- Drag and drop the operation blocks you want to use for your If/Else processing onto the workspace. Note that you can nest any Source or Target operations, as well as a For Each Child or even another If/Else block.
- Select the If/Else block.
- Select the General link from the Properties panel. From here, you can:
- Change the labels to add more details about the If or Else operations.
- Add a description.
Note: You can leave either the If or Else clause empty. - Select the Condition tab and define one or more Boolean conditions for the If/Else actions. The condition must evaluate to True or False. See Boolean Conditions for more details. Note: If the condition evaluates to True, TIBCO Cloud™ Integration - Connect always processes the blocks nested within the If. If the condition evaluates to False, the blocks within the Else are processed.
- When you run the flow, TIBCO Cloud™ Integration - Connect evaluates the condition(s) within the If/Else Block, and branches depending on whether the condition evaluates to True or False.
Block Properties - General Tab
After you drag and drop the If/Else block into your flow, change the labels to add more details about the If or Else operations.
Block Properties - Condition Tab
Define one or more Boolean conditions. A Boolean condition is a statement that evaluates to either true or false. For example, does the value in the Name field equal "Dave". If the value does equal "Dave", the condition is true. TIBCO Cloud™ Integration - Connect uses the defined condition to determine the execution of the flow.
Boolean Conditions
The Conditions in the If/Else block determine which set of blocks to run. If the rule has both ANDs and ORs, all of the ANDs are evaluated first. In the example below there are several combinations of data values that would evaluate to True.
And/Or |
Field |
Operator |
Value |
---|---|---|---|
|
Customers.CompanyName |
equals |
"McDonald's" |
or |
Customers.CompanyName |
equals |
"Burger King" |
and |
Customers.CreditAmount |
is greater than |
1000 |
or |
Customers.CreditAmount |
is greater than |
5000 |
These settings are interpreted by TIBCO Cloud™ Integration - Connect as follows:
( CompanyName = McDonalds OR (CompanyName = Burger King AND CreditAmount > 1000) OR CreditAmount > 5000)
To evaluate to TRUE, the record must meet at least one of these three conditions:
- Company name is Burger King and Credit Amount > 1000
- Company name is McDonalds
- Credit Amount > 5000
Block Properties - Errors and Warnings Tab
If there are any errors or warnings for this block, the Errors and Warnings tab displays the number of errors or warnings in the tab name. See Block And Flow Errors And Warnings.
Once you have corrected the errors, select the Validate button to update the Errors and Warnings tab.