Else
Use the Else task to divide an If block into two sections: one that runs when the condition is true, and one that runs when it is false.
- Tasks before the Else run when the If condition is true.
- Tasks after the Else (up to End If) run when the If condition is false.
Note: Each If block can contain a maximum of one Else task. There is no
Else If task; to handle multiple conditions, use a nested If block inside the
Else section.
Example
The following job applies different bookmarks depending on a document property:
Open Analysis from Library
If
result = AutomationContext.Application.Document.Properties["Region"] == "EMEA"
Apply Bookmark "EMEA Dashboard"
Else
Apply Bookmark "Global Dashboard"
End If
Export Report to PDF
When
Region is "EMEA", the EMEA bookmark is applied.
Otherwise, the Global bookmark is applied. The report is exported regardless of
which branch runs.