Help Desk

Submit a ticket My Tickets
Welcome
Login

Conditional Logic

When building Chains, there may be cases where there is a need to add additional Commands based on the outputs certain Commands create. With the addition of the Conditional Chain Event, variables and Command outputs can be tested using text matching, regular expressions, and boolean logic.

Conditional Chain Event

To add a Conditional Chain Event, select the operation from the left-hand selector and drag on to the pallet. 

Once the conditional has been added, start building out the logic. Conditionals are made up of groups and conditions. Each group is assigned a type of boolean logic, either an OR or an AND.

  • AND: All conditions must evaluate to True for the group to also be True.
  • OR: At least one of the conditions must evaluate to True for the group to also be True.

By using groups in this way, you can construct complex sets of boolean logic, or simply just test one value as shown below: 

In the example above, a group has been created that is assigned AND. In this case, the conditional will be considered successful if the current date (System.DateTime) is greater than the date of the previous chain run (Chain.PreviousExecutionDateTime), AND, the text "Test value" starts with the text "Test."  As illustrated, it is easy to tell that this would always be true, but in a real use case, there would likely be testing of the previous commands outputs against predefined values or comparing the outputs of multiple commands.

The following example extends the previous example by adding in a group that is also included in the logic evaluation. 

Conditional Logic and Warnings

Unlike Commands, after a conditional, there is no option for a Warning condition since conditionals are boolean logic. As such, the conditional is either a "success" or a "failure," and when adding subsequent chain nodes, only Success, Error, and Any are available. If the conditions specified are true, the Chain will continue down the Success path.

Setting a Warning

Use the Set Chain Result if there is a requirement to force a warning based upon the result of a conditional test.

Conditional Syntax

OneCloud Chain logic is built graphically, but it is still important to understand the various data types and operations that are tested and supported.

Data Type to Test

Data TypeDescription
StringOne or more characters
IntegerAny non-decimal numeric value
DateAny date string or variable of type date
FloatAny numeric value
JSONJavaScript Object Notation - Use the Variable Transformation to select objects from.

Operation to Test

TestApplies to
Is blank / is not blankAll
ContainsAll
Matches regular expressionAll
Start with / Ends withAll
= and !=
Integer, date, and, float
< and <=
Integer, date, and, float
> and >=
Integer, date, and, float

What's Next?

How to use the Runtime File Upload Chain Event.

B
Brian is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.