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

Can't use item() inside of filter action, inside of Apply to each

I currently have a json object that has an array inside of it, where each object inside of the array also contains a field that has another array. I use an apply to each loop on the json field for the containing array.

 

I next want to filter only the items that I want from the inner arrays. However, when I refer to "item()" within the filter action, the item() is instead referencing the current Apply_to_each context, rather than the current filter action.

 

Is it possible to have a filter inside of a loop and still be able to refer to the current filter action iteration?

3 REPLIES 3
abm
Super User
Super User

Hi @djohns505_tfb 

 

Could you please post a sample JSON file?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
djohns505_tfb
Frequent Visitor

Just a simple nested array:

 

 

[
  {
    "field1": false,
    "field2": [
      { "inner": 1 },
      { "inner": 2 }
    ]
  },
  {
    "field1": false,
    "field2": [
      { "inner": 1 },
      { "inner": 2 }
    ]
  }
]

 

 

Hi @djohns505_tfb 

 

Thanks for the JSON example. What you trying to filter here from field2? What data you expect after the filter?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (535)