Are you struggling to get your decision diamonds working when you want to test that a contact doesn’t have either of two or more tags, or field values?
This is caused by a common mistake when translating natural language into logic that Infusionsoft understands.
Help is at hand.. this article is going to help you understand the problem so you can get it right from now on in. No more broken decision diamonds, and no more additional decision diamonds when one will do the job (and is easier to debug, change, and document).
Click here to jump to the solution if you don’t want to dive into the why and how…
Let’s say you have two sequences, and you want to send the contact to one of these based on them having either one of two tags, therefore they go to the other sequence if they don’t have any of the two tags. You might right this like so…
- If contact has Tag 1 or Tag 2 then go to Sequence A
- If contact doesn’t have Tag 1 or Tag 2 then go to Sequence B
Ok that makes sense. We all understand what we want to have happen here. So we then create the following decision diamond rules…
- Sequence A: If the Contact’s Tags contains Tag 1 or Tag 2
- Sequence B: If the Contact’s Tags doesn’t contain Tag 1 or Tag 2
BOOM! Right? That will work yeah…
This is the common mistake. The first rule is fine.. but the second rule needs to be changed. But why?!? You ask… I am glad you asked!
The problem comes down to what is known as order of operations (or operator precedence). Remember in math class that × and ÷ took precedence over + and – ? Well the same thing happens in logic.
The way to change this is to use brackets – e.g. 3 + 4 × 5 = 23 because × takes precedence over the + but if you wanted to add the numbers first you would use brackets like this: (3 + 4) × 5 = 7 × 5 = 35.
So how does this relate to our decision diamond rule?
Well in logic NOT takes precedence over AND which takes precedence over OR. So the doesn’t have is equivalent to the logic operator NOT, so it only applies to Tag 1, and not to both tags.
What we really want, in logic language, is NOT(Tag1 OR Tag 2) but what we have created is actually (NOT Tag 1) OR Tag 2.
What this ultimately means is that contacts will go to sequence B if they don’t have Tag 1 or if they DO have tag 2. So if they have Tag 2 they will end up in both Sequence A and B – sound familiar?
OK I Think I Follow, But How Do I Fix It?!
OK so now that we know how Infusionsoft is treating this logic, we can change the rule slightly to get the result we want. This is what you need to change the second rule to…
- If the Contact’s Tags doesn’t contain Tag 1
AND if the Contact’s Tags doesn’t contain Tag 2
… to get the same result we have had to replace the OR with an AND on a second line, as well as add a second doesn’t contain.
What this new rule is saying is: if the contact doesn’t have Tag 1 and the contact doesn’t have Tag 2 then go to sequence B. Or in other words, if the contact doesn’ have either Tag 1 or Tag 2. Which is what we initially were after.
Now they will only go to Sequence B if they don’t have Tag 1 or Tag 2 and the decision diamond will work perfectly.
OK so if you are still a bit confused, don’t worry you just need to follow this simple rule:
If you want to test for doesn’t have Tag 1 or Tag 2 or Tag 3 etc. Then just use the additional lines of AND with the doesn’t contain option for each Tag (or field value).