289 total views, 13 views today
In this article, we will learn how to check null or empty in Power Automate. There are many ways to check a null or empty string variable’s value in Power Automate; here we will learn the best approach.
Check null or empty in Power Automate
Below is the complete Power Automate flow that checks the null or empty condition.
Approach 1: Check null condition in Power Automate Filter Query
We need to add the null condition in the below format in the filter query:
ColumnInternalName eq null
- We have extended the condition to handle the content type-based filter as well; this is optional but recommended if you want to retrieve all documents from a given content type.
- In this demo, the “POStatus” column is a choice type column.
Approach 2: Check null condition inside the apply to each control loop
Another way of checking the null condition is to get all items using the “Get Items” action without adding any query filters to it.
Add an “apply to each” control and pass the value from the previous step, “Get Items” as an input parameter.
Set the column value (for which you want to check null or empty) to a variable.
Then, add a “condition control” where you check the below condition:
empty(variables('varStrPOStatus')) is equal to true OR length(variables('varStrPOStatus')) is equal to 0
- In the above condition, we are checking whether the variable “varStrPOStatus” value is empty or has zero length.
- If this expression returns true, that means the value in the “POStatus” choice column in SharePoint has an empty value.
- Now, based on the yes-or-no condition, you can add your further business logic.
Demo: Check null condition inside the apply to each control loop
Now, execute the flow, and we can see three items have been retrieved by the filter query.
Check the null or empty condition in the SharePoint Online document library by filtering the view
We can check the null or empty condition in the SharePoint Online document library by filtering the view like below:
Summary: Check null or empty in Power Automate
Thus, in this article, we have learned the following with respect to checking the null or empty condition in Power Automate:
- How to check null or empty in Power Automate for the choice column.
- Check the null or empty condition in the SharePoint Online document library by filtering the view.
See Also: Power Automate Articles Hub (with real-time example)
If you like our articles, please appreciate our efforts by liking and sharing them with your friends and colleagues. Please join the mailing list to get our articles in your inbox as and when we publish them.
Happy automating and learning!