Usage Of Empty Function In Power Automate

Introduction

In Power Platform, at times we must verify whether the given JSON object or string or array has an empty value or not. In Power Automate, Empty Function can be used quickly to find out whether empty value is present or not.

Step 1

Login to the required Power Apps environment using URL make.powerapps.com by providing username and password and click on Flows on the left-hand side as shown in the below figure.

Usage of Empty Function in Power Automate

Step 2

After Step 1, Click on New Flow and select instant cloud flow and provide the trigger as Manually trigger a flow and click on Create as shown in the below figure.

Usage of Empty Function in Power Automate

Step 3

After Step 2, name the flow as Empty Function and take a parallel branch and one side of branch take an initialize variable and name it as Initialize variable - Array Names and provide values

Name: Names
Type: Array
Value: ["Venkata","Polisetty","Subbarao"]

as shown in the below figure.

Usage of Empty Function in Power Automate

Step 4

After Step 3, to the other side of parallel branch take another initialize variable and name it as Initialize variable - String Name and provide values

Name: Name
Type: String
Value: "Venkata"

as shown in the below figure.

Usage of Empty Function in Power Automate

Step 5

After Step 4, another end of parallel branch take an action and name it as Initialize variable - Json Names and provide values as

Name: Names Json
Type: Object
Value: {
    "Names": {
        "Names1": "Venkata",
        "Names2": "Subbarao",
        "Names3": "Polisetty"
    }
}

as shown in the below figure.

Usage of Empty Function in Power Automate

Step 6

After Step 5, under Initialize variable - Array Names take compose action and provide empty function which Returns true if an object, array, or string is empty and use empty function as

empty(collection: object|array|string)
and provide values as
empty(variables('Names'))

in the below figure.

Usage of Empty Function in Power Automate

Step 7

After Step 6, under Initialize variable - String Name, take compose action and provide inputs as

empty(variables('Name'))

in the below figure.

Usage of Empty Function in Power Automate

Step 8

After Step 7, under Initialize variable - Json Names take compose action and provide inputs as

empty(variables('Names Json'))

in the below figure.

Usage of Empty Function in Power Automate

Step 9

After Step 8, save and test the flow and observe the results as shown in the below figure.

Usage of Empty Function in Power Automate

Note

  1. Make sure to save and run the flow whenever you try expressions.
  2. Make sure to provide input array in the proper acceptable format of string array.
  3. Also, use double quotes for the elements in the array.
  4. For object, make sure to frame it as JSON object.

Conclusion

In this way, we can use empty function in power automate to achieve customer functionality.


Similar Articles