Hi all, I've experienced a very strange behavior: the same expression when is written in "compose" action and "Set variable" provide different output in IF statement.
Some details: in my case I compare email arrival date with another date (doesn't matter which one, in this case). Initially I tried to initialize 2 variables of type string and then compare dates for email and last day of month using DateFormat function. When setting the variables everything looks good: both outputs are the same as they are expected:
Now, when I compare them, with the following statement:
Code view so you can verify that I'm using 2 variables from above:
the result is false (I expect it to be true!):
Now, I used compose instead of variables (no other change to the flow):
Using the same code as for variables from above to create compose and indeed get the exact same result
Now, when I compare them, with the following statement:
Code view so you can verify that I'm using 2 compose outputs from above:
I get the correct result!
Any ideas what is going on?
P.S. I've tried using ticks() function as well and again, values in variables are the same (Excel confirms it) but IF statement result is false.
@Sergii24 Can you verify there aren't any trailing spaces in either of your variables or Compose actions?
Although these two Compose action outputs look the same, the second one has a trailing space.
This will result in the condition being false.
Use the trim() function. Wrap the output of both of the Compose actions (or variables) in the trim() function. Run a test.
Without editing the values in the Compose action, the Condition returns true.
You may be interested in these YT Tutorials:
7 Functions You Need to Know | ⚡️Expression Essentials: Part 1⚡️
In the full tutorial I cover 7 functions you need to know when getting started with expressions.
1️⃣ empty()
2️⃣ coalesce()
3️⃣ equals()
4️⃣ if()
5️⃣ concat()
6️⃣ length()
7️⃣ split()
I cover how to use these functions in expressions and I’ll also cover common mistakes when it comes to writing expressions and show you a few tips and tricks along the way.
As a beginner or even an intermediate flow builder—expressions can seem a bit complex at first, I’m going to try to simplify it for you. If you want to level up your flows by writing expressions—keep watching!
IN THIS VIDEO:
✅ What is an Expression?
✅ What is a Function?
✅ What Does Wrapping a Function Mean?
✅ How Do I Insert an Expression?
✅ How to Use a Compose action
✅ How to Navigate the Expression Builder with Arrow Keys
✅ How to use the Expression Tooltip
✅ Common Mistakes When Writing Expressions
✅ How to differentiate a null from an empty string
✅ How to Get Dynamic Content When it’s Not Listed
✅ How to Use a Get Item Action to Verify Dynamic Content Output
✅ How to Convert Strings to Lower Case
✅ How to Troubleshoot the if() Function
----
5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows
In this Power Automate tutorial, I explore 5 frequently asked questions that pop up when troubleshooting a flow. If you’d like to to level up your Power Automate flow skills and learn how to troubleshoot your Power Automate flow—this tutorial is for you!
IN THIS VIDEO:
✅ How to troubleshoot a false Condition action result
✅ How to get dynamic content when it isn’t selectable from the list of dynamic content
✅ How to troubleshoot an Apply to Each action that isn’t looping through
✅ How to troubleshoot a skipped Apply to Each action
✅ How to troubleshoot a Filter Query
✅ How to use a SharePoint yes/no column in a Filter Query
✅ How to use Compose actions to troubleshoot a Power Automate flow
✅ How to troubleshoot multiple emails being sent
✅ How to troubleshoot multiple Teams messages being sent
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492