cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ganeshn07
Frequent Visitor

Use Output of compose in get items filter query

Hi

I need help in using filter query in get items from compose outputs.

 

Below is the output from compose 

[
  "First",
  "Second"
]
 
I need to pass this in filter if the name matches in the list, but below is how I get the output 
 
ganeshn07_0-1670172743737.png

 

Please help how I can compare and get items from the list if it matches.

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-liwei-msft
Community Support
Community Support

Hi @ganeshn07 

 

You can use or to connect two conditions in the filter query (note the single quotes).

vliweimsft_0-1670203311029.png

Title eq 'A' or Title eq 'B'

 

Best Regards,

Levi

View solution in original post

grantjenkins
Community Champion
Community Champion

Here's an example that should work with as many items in your array as you want. Effectively, it builds up the filter for each item separated by an or clause.

 

Full flow below. I'll go into each of the actions.

grantjenkins_0-1670211400776.png

 

Compose contains your array of items.

grantjenkins_1-1670211444361.png

 

Select will build up an array of individual conditions. The expression used here is:

concat('Title eq ''', item(), '''')

grantjenkins_2-1670211514349.png

 

If I ran my flow now, I'd get the following output from my Select:

[
  "Title eq 'First'",
  "Title eq 'Second'"
]

 

Join will join each of the items above, separated by ' or '.

grantjenkins_3-1670211639097.png

 

The output from my Join would be:

Title eq 'First' or Title eq 'Second'

 

Get items can then use the output from the Join as the Filter Query we need.

grantjenkins_4-1670211706446.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

View solution in original post

3 REPLIES 3
Rhiassuring
Super User
Super User

If you just want the First one, you can use the expression "first()" - in between the brackets you put the output from your Compose.

 

If you want to do it for each item in your Compose's output, you can use an "Apply to Each" and then point the Filter Query at the "Current Item" (it'll be at the very bottom of your dynamic content). 

 

Like this:

 

Rhiassuring_0-1670198234410.pngRhiassuring_1-1670198252181.png

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



v-liwei-msft
Community Support
Community Support

Hi @ganeshn07 

 

You can use or to connect two conditions in the filter query (note the single quotes).

vliweimsft_0-1670203311029.png

Title eq 'A' or Title eq 'B'

 

Best Regards,

Levi

grantjenkins
Community Champion
Community Champion

Here's an example that should work with as many items in your array as you want. Effectively, it builds up the filter for each item separated by an or clause.

 

Full flow below. I'll go into each of the actions.

grantjenkins_0-1670211400776.png

 

Compose contains your array of items.

grantjenkins_1-1670211444361.png

 

Select will build up an array of individual conditions. The expression used here is:

concat('Title eq ''', item(), '''')

grantjenkins_2-1670211514349.png

 

If I ran my flow now, I'd get the following output from my Select:

[
  "Title eq 'First'",
  "Title eq 'Second'"
]

 

Join will join each of the items above, separated by ' or '.

grantjenkins_3-1670211639097.png

 

The output from my Join would be:

Title eq 'First' or Title eq 'Second'

 

Get items can then use the output from the Join as the Filter Query we need.

grantjenkins_4-1670211706446.png

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,604)