Complex condition linking

Complex condition linking


Using “AND” “OR” logic to create simple and complex (nested) condition linking

Simple “AND” Condition Linking

Conditions are linked together in Logicblocks. In most scenarios, the easy “AND”-linking of conditions is the way to go – all conditions must be met in order to get a positive result. This can be translated into a sentence like

  • IF it is dark outside AND I’m not at home AND my partner is not at home THEN switch on the lights

Complex Condition Linking

But some users really want to push the envelope and feel limited by the AND-chaining of conditions. That’s where the Complex Condition Linking helps out.
With Complex Condition Linking you can

  • Use the OR-operator instead of, or in combination with, the AND-operator
  • Create nested expressions

To build up on the example use above, you can model a sentence like this

  • IF (it is dark outside OR it is after 7pm) AND I’m not at home AND my partner is not at home THEN switch on the lights

You can switch to Complex Condition Linking by selecting the option on any Logicblock.
To model the expression you can use the logical operators

  • AND
  • OR

Important: Make sure that you check the box for any relevant condition in the condition list.
Apilio will parse your condition linking statement on save and will give you an error message in case it cannot match a condition name from your expression with a linked condition!

In general, the syntax is similar to the one used in Microsoft Excel products (Microsoft Help articles for AND, OR).
Define the operator followed by a list of comma-separated conditions in parantheses.

  • Operator(condition_1[,condition_2] …)
  • e.g. AND(condition_1,condition_2,condition3)

You can replace any condition by another expression, thus creating nested expressions.

  • e.g.AND(OR(dark_outside,after_7pm),me_not_home,partner_not_home)

Getting started - an introduction to Apilio