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 / Trying to write an exp...
Power Automate
Answered

Trying to write an expression instead of using Filter Array

(1) ShareShare
ReportReport
Posted on by 20
Hello everyone
 
I create this follow array using a Select action after List Buckets Action for a MS Planner Board. I am wondering if I can write an expression instead of using a filter array and then a compose to get the bucketid when the bucketname is "To do".
{
    "body": [
        {
            "bucketid""xOfg9k9Xu0-DmGU3PHdQPGQAANep",
            "bucketname""Done"
        },
        {
            "bucketid""uskhJSr-tUaZGan7DeIvOGQANnfy",
            "bucketname""Hold"
        },
        {
            "bucketid""EXaN1yv3m0y4CnDpJS0IHGQADIFF",
            "bucketname""In Progress"
        },
        {
            "bucketid""knOOX-GfSUuN4HjPC9n6ZWQAAkhY",
            "bucketname""To do"
        }
    ]
}
Categories:
I have the same question (0)
  • Verified answer
    StretchFredrik Profile Picture
    3,395 Super User 2025 Season 2 on at
    Hello,
     
    I believe Filter array is your best bet here, unless the bucket is always returned as the 3rd element for example. In that case you could do Array[2] for example. Is there any reason you would like to get ridd of the Filter array? In my experience its very fast. 
     
    If my response solved your issue, please mark it as ✅ Accepted Answer and give it a like.
  • AI-24061946-0 Profile Picture
    20 on at
    I am new to this platform and wanted to see if there are other ways of accomplishing this, but your answer makes perfect sense as I am doing that currently and thank you for your prompt response.  
  • Verified answer
    WillPage Profile Picture
    2,307 Super User 2025 Season 2 on at
    If you absolutely must avoid using the Filter array action, you can convert the JSON array to XML and then use the xpath() function to lookup an individual item on the buckename and return the bucketid.
     
    1. Original JSON
     
    2. Add a root property
     
    3. Convert to XML
     
    4. XPATH function
     
    Output is the bucket ID. No Filter array action:
     
    Big question though: Why would you do this? It's more work.
  • Verified answer
    Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at
    first(
    	xpath(
    		xml(
    			addProperty(
    				json('{}'),
    				'Root',
    				addProperty(
    					json('{}'),
    					'Item',
    					body('Compose')
    				)
    			)
    		),
    		'//Item[bucketname="To Do"]/bucketid/text()'
    	)
    )
  • AI-24061946-0 Profile Picture
    20 on at
    Thank you so much for opening up my eyes about using Xpath. You are 100% correct that at my beginning skill level, using the Select array gets the job done. I wanted to see how advance users would handle this issue using other mechanisms.

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard