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 / Top condition in filte...
Power Automate
Unanswered

Top condition in filtered Array

(0) ShareShare
ReportReport
Posted on by 20

Hi Experts,

Hope you are doing good.

 

I am pulling a json file through and API call and then use parse Json in flow to read through it. This works fine, then i also use filter array to get only one part in the entire JSON file but some of the values are repeated but i want only one of those. Is there a Distinct or Top 1 in the filter array that i can use?

 

Example:

Davy_0-1595367212904.png

 

[ 
{ "first": "Deon", "last": "Herb","Color" :"Blue","Time":"2020-07-21 08:06:22 -04:00" }, 
{ "first": "Deon", "last": "Herb","Color" :"Blue","Time":"2020-07-21 07:08:22 -04:00"}, 
{ "first": "K", "last": "Herb","Color" :"Yellow","Time":"2020-07-21 04:06:22 -04:00" },
{ "first": "K", "last": "Herb","Color" :"Yellow","Time":"2020-07-21 08:17:22 -04:00" } ]

 

Lets say the above is the output from the Parse JSON, now i want it filtered for color -Blue. When i use the filter JSON in the flow and select the field to be color and then give the value as Blue it does filter and shows me the first two lines but i want only one line. How can i do it? is there a way i can give a condition in the filter array to get what i desire or should i use some other connector to achieve it?

Thanks in advance for your response.

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @Davy 

     

    Currently the filter array action does not accept an input parameter to return a specific number of items (or the top count). If you want to get the first item (considering the example with the filter for blue that you have mentioned), you can add a compose action and then use the first() function to get the first row from the array. You can also use indexing (e.g., nameofArray[0]) this returns the index row from the array. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • Davyjones Profile Picture
    20 on at

    @yashag2255 

     

    Thank you very much for your response. I tried that and using compose on the filtered array with the first function returns one set. The only problem there was now the compose output was a whole element that i was not able write another compose to get just the name value out of it. I had to use ParseJson on the output of the compose and then write another compose to get the actual name, is that a right approach?

    Davy_0-1595428039665.png

     

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 223

#2
David_MA Profile Picture

David_MA 210 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 175

Last 30 days Overall leaderboard