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
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

PWREduCon768x460.png

Join us at PWR EduCon - A Power Platform Conference

Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Users online (3,541)