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 Automate
Answered

dynamic filter array

(0) ShareShare
ReportReport
Posted on by 4

I have 2 lists where I want to match 2 multivalue columns, List1 contains maintenance data (more companies could be affected so company contains several ids. Company is selected from a companylist btw. List2 is a list with a person and the companies he wants to be informed of when maintenance takes place.

For a single value this works with a Filter Array: "@or(contains(item()?['Comp#ID'], variables('ID')),contains(item()?['Comp#ID'],119))"

 

My idea was to create a string from the array of companies the user is interested in

- add a string to an array 'contains(item()?['Comp#ID'], @{items('EachComp')})

- then join that array with a ','

- in a compose (composeFilter) create the filter

@or(contains(item()?['Comp#ID'], 39),contains(item()?['Comp#ID'], 27),contains(item()?['Comp#ID'], 28),contains(item()?['Comp#ID'], 43),contains(item()?['Comp#ID'], 119))

and use that in the filter with the statement @outputs('composeFilter')

the result is

InvalidTemplate. The execution of template action 'Filter_Companies' failed: The result '@or(contains(item()?['Comp#ID'], 39),contains(item()?['Comp#ID'], 27),contains(item()?['Comp#ID'], 28),contains(item()?['Comp#ID'], 43),contains(item()?['Comp#ID'], 119))' of the evaluation of 'query' action 'where' expression '@outputs('composeFilter')' is not a valid boolean value.
 
If I insert this string as the filter to test it the flow runs without error.
Is it possible to create a dynamic filter in this way?
Or is there a simpler way to achieve this?
Categories:
I have the same question (0)
  • Verified answer
    v-litu-msft Profile Picture
    on at

    Hi @WalterM,

     

    It's unfortunate that the Filter array advanced mode not support input "@" into it.

    But you could do in the Get items filter query field.

    Comp#ID eq 27 or Comp#ID eq 28

    For example:

    Screenshot 2020-12-08 163437.jpg

     

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • WalterM Profile Picture
    4 on at

    I thought it would be more elegant/better for performance to use the filter but as that does not work I moved the get items to inside the for each subscriber and do the filtering there as expressions are possible there

    (Eventdate ge '@{utcNow()}') and (@{body('strFilter')})

    where strFilter results in "Comp eq 39 or Comp eq 27 or Comp eq 28 or Comp eq 43 or Comp eq 119"

     

    Thank you

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

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard