Skip to main content

Notifications

Community site session details
Power Automate - Building Flows
Answered

Need help filtering arrays with objects

Like (3) ShareShare
ReportReport
Posted on 29 Aug 2024 20:46:14 by 56
I'm working on a flow where I need to be able to detect changes between two arrays with objects. 

varPrevious:
 
[
{"uniqueID": "1111", "FirstName": "John", LastName: "Smith", "Age": "30"} ,
{"uniqueID": "2222", "FirstName": "Peter", LastName: "Paul", "Age": "32"} ,
{"uniqueID": "3333", "FirstName": "Steve", LastName: "Johnson", "Age": "25"} ,
{"uniqueID": "4444", "FirstName": "Randy", LastName: "Moss", "Age": "26"} 
]


varCurrent:
 
[
{"uniqueID": "1111", "FirstName": "John", LastName: "Smith", "Age": "30"} ,
{"uniqueID": "2222", "FirstName": "Peter", LastName: "Paul", "Age": "32"} ,
{"uniqueID": "3333", "FirstName": "Steve", LastName: "Smith", "Age": "25"} ,
{"uniqueID": "5555", "FirstName": "Jerry", LastName: "Rice", "Age": "34"} 
]
 
Given the two arrays I would like to be able to filter out new entries, deleted entries, and modified entries for reporting purposes.
 
End Goal:
New Entries: 
[{"uniqueID": "5555", "FirstName": "Jerry", LastName: "Rice", "Age": "34"} ]
 
Deleted Entries: 
[{"uniqueID": "4444", "FirstName": "Randy", LastName: "Moss", "Age": "26"} ]
 
Modified Entries:
[{"uniqueID": "3333", "FirstName": "Steve", LastName: "Smith", "Age": "25"} ]


I have tried using the filter array action but I can't seem to figure it out. 

 
Output: 
[
{"uniqueID": "3333", "FirstName": "Steve", LastName: "Smith", "Age": "25"} ,
{"uniqueID": "5555", "FirstName": "Jerry", LastName: "Rice", "Age": "34"}
]
 
 
The filter array action above returns the modified object (id:3333) and the new object (id:5555). The same happens when I filter for the deleted object. The filter array action returns the modified object (id:3333) and the deleted object (id:4444).
 
 
Any help would be greatly appreciated.

Thanks
  • Verified answer
    jody1213 Profile Picture
    56 on 30 Aug 2024 at 16:21:51
    Need help filtering arrays with objects
    Please disregard as I was able to figure it out!

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started