Filter Array Returning Empty Value

Introduction

Recently, I was having trouble filtering out the values from an array based on a year. When trying to configure the array as per the screenshot below, I am getting an empty array returned at the end. Below is the screen capture for reference.

Filter Array

Below is the screen capture of the array object.

Array object

When using the filter array with the below configuration, it gives the empty array.

Filter array with the configuration

Filter array with the Output

Reason

The reason why we are getting the empty array is that the object defined in the array is a type of string. The value 2024 is defined in quotes in the array.

Object defined in array is of type of String

Fix

It is required to convert the 2024 to string using Power Automate expressions and then use the Filter Array option. Below is the correct way of filtering the arrays of type string. We need to get the equivalent string value of 2024.

Below is the screen capture of the correct configuration.

Fix the Configuration

Result

Below is the result of the Filter Array.

Filter array

Conclusion

Thus, in this article, we have seen how to filter out an array in a special case where the year value is defined as a string.