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

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard