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.
![2 Best way to check null or empty in Power Automate 3 Check null or empty in Power Automate flow](https://i0.wp.com/global-sharepoint.com/wp-content/uploads/2022/12/Check-null-or-empty-in-Power-Automate-flow.jpg?resize=610%2C309&ssl=1)
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
Note:
- 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.
![2 Best way to check null or empty in Power Automate 4 Choice column null condition in Power Automate Get Items filter query](https://i0.wp.com/global-sharepoint.com/wp-content/uploads/2022/12/Choice-column-null-condition-in-Power-Automate-Get-Items-filter-query.jpg?resize=620%2C404&ssl=1)
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
Note:
- 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.
![2 Best way to check null or empty in Power Automate 5 Check null condition inside the apply to each control loop](https://i0.wp.com/global-sharepoint.com/wp-content/uploads/2022/12/Check-null-condition-inside-the-apply-to-each-control-loop.jpg?resize=1084%2C517&ssl=1)
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.
![2 Best way to check null or empty in Power Automate 6 Check null condition inside the apply to each control loop demo](https://i0.wp.com/global-sharepoint.com/wp-content/uploads/2022/12/Check-null-condition-inside-the-apply-to-each-control-loop-demo.jpg?resize=585%2C508&ssl=1)
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:
![2 Best way to check null or empty in Power Automate 7 Check null or empty condition using filtering the view in SharePoint Online document library](https://i0.wp.com/global-sharepoint.com/wp-content/uploads/2022/12/Check-null-or-empty-condition-using-filtering-the-view-in-SharePoint-Online-document-library.jpg?resize=720%2C410&ssl=1)
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)
- You may visit the Power Automate articles hub
- Take care of what’s important. Automate the rest
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!