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:

Using The If/Else Block

  1. 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.
  2. Select the If/Else Block.
  3. Select the General link from the Properties panel. From here, you can:

    Note: You can leave either the If or Else clause empty.

  4. 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 below these steps.

    Note: If the condition evaluates to True, TIBCO Scribe ® Online always processes the Blocks nested within the If. If the condition evaluates to False, the Blocks within the Else are processed.

  5. When you execute the Map, TIBCO Scribe ® Online evaluates the condition(s) within the If/Else Block and branches depending on whether the condition evaluates to True or False.

Note: Depending on your requirements, you can use the Result Fields to look at the results from a previous Block, such as a Lookup Block.

Block Properties — General Tab

After you drag and drop the If/Else Block into your Map, 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 Scribe ® Online uses the defined condition to determine the execution of the Map.

Boolean Conditions

The Conditions in the If/Else Block determine the set of Blocks to be executed. If the rule has both AND's and OR's, all of the AND's are evaluated first. In the example below there are several combinations of data values that would to 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 Scribe ® Online 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:

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 Map Errors And Warnings.

Once you have corrected the errors, select the Validate button to update the Errors and Warnings tab.

Related Topics

Control Blocks

For Each Child Block

Loop Block

Loop Exit Block