Comparisons as extremely useful in any programming language or platform and Power Automate is not the exception. The “equals” function helps us to have two values and compare if they are “equivalent”. Notice that we’re not comparing if they are the same, but this will make sense below.
So let’s check it in more detail.
It follows a simple pattern.
- Object 1 to compare
- Object 2 to compare
Let’s start with a simple example:
equals(10,10) will return tre
It works also with float numbers:
equals(12.2,12.2) will return true
Now let’s look at strings. The comparison is case-sensitive and requires that all characters are the same. For example:
equals('a','a') returns true
equals('a','A') returns false
Let’s compare boolean values now, but one of them is a string:
equals('true',true) returns false
They are different datatypes and we can’t convert a random string (even if the characters are the same), with boolean. But how about ints?
equals(1,true) returns true
Let’s look at an array:
equals(createArray(1,2,3),createArray(4,5)) will return false
They are different so it makes sense. How about if the arrays are the same?
equals(createArray(1,2,3),createArray(1,2,3)) will return true
So we can use the equals function to compare arrays.
Depending on the size of your string, your expression may return an error, even if it’s correct. Please note that the expressions have a max size of 8,192 characters. If you have an expression that is even bigger than 1000 I would strongly advise that you break it into smaller manageable formulas.
Here are some things to keep in mind.
Use “debug” compose actions
Since the comparison will return true or false, sometimes it’s tricky to understand how the calculation is done, depending on how complex the expression is. So I recommend using Compose actions to have the values that go “in” the function. This way, if the value doesn’t make sense you can understand, based on the parameters, why it was calculated that way.
There’s no real reason to do it. In fact if you try to nest “equals” functions you’ll receive an error unless it’s a boolean either in the left or right side, but that would not be very helpful. If you have a scenario where it makes sense to have “equals” functions please let me know.
Be very careful to avoid breaking Flows.
Microsoft’s equals Function Reference
Back to the Power Automate Function Reference.
How to use the Power Automate “equals“ function? I’ll explore the basics, tips, and tricks on using it efficiently in your Flows.
How to use the “equals“ function in #PowerAutomate? Check out how to use it efficiently, the basics and how they work, tips, and limitations. #PowerPlatform