web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to handle Filter A...
Power Automate
Answered

How to handle Filter Array [ ] - Blank/Null When There's No Match

(0) ShareShare
ReportReport
Posted on by 29

Hi, I need urgent help on how to handle Filter Array [ ].

 

Objective: I'm extracting the Billing Group Name from email and use the extracted value to check against the Master List (with all existing Billing Group Name). The purpose of checking is to validate if the Billing Account Name is new or existing.

 

My intention is to notify the team via email when:

Scenario 1.  When there's no match found (means new Billing Group Name found).

Send email to notify the team that further action is required.

 

Scenario 2. When there's match (means Billing Group Name are existing). Send email to notify the team that no further action is required.

 

My flow is working fine for Scenario 2 but not Scenario 1 because when no match found, the Filter Array is returning [ ]

 

Scenario 2: Working Fine and Email Sent Out Successfully

Georgia_H_3-1698404550138.png

 

Georgia_H_5-1698404886689.png

 

 

Scenario 1: Not Working Fine when [ ] (no match found in Master List)

Georgia_H_4-1698404611910.png

 

 

 

 

 

 

 

 

Categories:
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Georgia_H  when filter array doesnt find any match it will return [], you can add condition action to check the length of items returned by filter array is greater than 0 to avoid the error that you are currently facing.

  • Georgia_H Profile Picture
    29 on at

    Thanks for the reply. Could you show me how to achieve that in my flow?

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Georgia_H  please see example in below screenshot

    annajhaveri_0-1698414449878.png

    Below expression is used in the left side of condition using dynamic content -> Expressions tab

    length(body('Filter_array'))

     

    annajhaveri_1-1698414503893.png

     

  • Verified answer
    wskinnermctc Profile Picture
    6,519 Moderator on at

    If you adjust your expression, then it won't error. However, the Compose will be blank.

     

    You currently have:

    body('Filter_array')?[0]['billing_group_name']

    You change to:

    body('Filter_array')?[0]?['billing_group_name']

     The extra "?" question mark will allow a blank without having an error.

    Using first() will also prevent needing to have the zero [0] item identified.

    first(body('Filter_array'))?['billing_group_name']

     

    Adjusting this will allow the Compose step to run without error when the Filter Array is blank. But you will still need to do a condition check somehow so that you can format your email correctly.

     

    You could use the empty() function that will return true or false if there is any value.

    empty(body('Filter_array'))

     Filter Array .png

  • Georgia_H Profile Picture
    29 on at

    Hi @wskinnermctc Your suggestion works for my case because my requirement is to send email for the 2 scenarios. Many thanks for the kind help! Kudos to you 🙂

  • Georgia_H Profile Picture
    29 on at

    Hi @annajhaveri Thanks for your suggestion but that does not fit my requirement because I still need to send emails regardless if there's a match or not. Your suggestion only works when there's match, but when there's [ ], it didn't work.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 263

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard