web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Join the outcomes of m...
Power Automate
Suggested Answer

Join the outcomes of multiple FilterArray actions without using ApplytoEach

(0) ShareShare
ReportReport
Posted on by 2,104 Season of Giving Solutions 2025
I am doing multiple API calls inside an Apply To each, to get data from the same api but for different date/time. Then i am doing the following:-
1) RemoveSOAPTAgs from the API call response
2) Convert the outcomes to XML
3) Convert the XML to JSON
4) Parse the JSON
5) Filter the JSON
6) Loop through the result of the FilterJSON-IncludeUser and append the items inside an array named "jointJson"
 
 
 
The above is working where i will get all the JSON inside the "JointJson" array. but it is taking time, mainly on the "Apply to each 3" where i am building the "JointJson" array + the workflow is consuming many actions beyond the threshold limit i can have which is 48,000 calls each 24 hours.
 
So my question is , is there a way to join the result of the FilterJSON-IncludeUser actions inside the ApplyToEach without having to loop through the result and use ApendToArray?
 
The result of the "FilterJSON-IncludeUser" will be as follow:-
 
{"body":[{"@Id":"19267384","@AgentId":"11**","@CallDuration":"0:00:49","@CallOrigin":"Outbound - Manual","@CallSegment":"Initial","@CallTime":"12/2/2024 5:51:30 AM","@Campaign":"Affiliate","@ContactId":"42***74","@Group":"Openers","@InboundPhone":"","@LeadFullName":"Dj*** T***","@LeadId":"42***","@ProspectPhone":"+1***","@RecordingUrl":"","@Result":"Conversation","@TargetNumber":"+1 5***","@User":"****","@WaitTime":"","@CallId":"2****"},{"@Id":"19267387","@AgentId":"11657","@CallDuration":"0:00:35","@CallOrigin":"Outbound - Manual","@CallSegment":"Initial","@CallTime":"12/2/2024 5:52:54 AM","@Campaign":"Affiliate","@ContactId":"428***","@Group":"Openers","@InboundPhone":"","@LeadFullName":"**","@LeadId":"4286***","@ProspectPhone":"+*****","@RecordingUrl":"","@Result":"Conversation","@TargetNumber":"+1 ***","@User":"****","@WaitTime":"","@CallId":"C***7"}]}
 
 
or it will be empty.
 
 
any advice?
 
Thanks
Categories:
  • Cgangweg01 Profile Picture
    893 Super User 2026 Season 1 on at
    Hi -
     
    Not sure if this will help in your case but I did not use the Apply to Each action to combine filtered arrays into one JSON array. I used a compose union expression.
  • johnjohnPter Profile Picture
    2,104 Season of Giving Solutions 2025 on at
     
    Thanks , never though of benefiting from Union for this case, it actually worked well thanks, but i know that Union() will remove duplicate when we have a simple array, but not sure how the union() will work incase we are unioning complex objects, will the unquiness be defined based on all the properties?:-
     
    {"@Id":"19267384","@AgentId":"11**","@CallDuration":"0:00:49","@CallOrigin":"Outbound
    - Manual","@CallSegment":"Initial","@CallTime":"12/2/2024 5:51:30
    AM","@Campaign":"Affiliate","@ContactId":"42***74","@Group":"Openers","@InboundPhone":"","@LeadFullName":"Dj***

    T***","@LeadId":"42***","@ProspectPhone":"+1***","@RecordingUrl":"","@Result":"Conversation","@TargetNumber":"+1
    5***","@User":"****","@WaitTime":"","@CallId":"2****"}
     
    how the duplicate will be indicated?
  • Suggested answer
    SamLed Profile Picture
    2,340 Moderator on at
    Hi johnjohnPter,
     
    To illustrate my solution, I simulate a loop of your HTTP calls by an array of 2 sets of the json data you provided, the filter does nothing here but it represent yours, outputs are the same.
     
      
     
    One solution is to use a compose action outside of your first "apply to each" and reference the outputs of the filter that sits inside. Power automate will automatically return an array of each "Filter array" output that are also arrays. So you get a nested array, you need to flatten into a single array. The full expression is:
     
    json(replace(replace(string(body('FilterJSON-IncludeUser')),'[{','{'),'}]','}'))
     
    Result:
     
    [
        {
            "@Id": "19267384",
            "@AgentId": "11",
            "@CallDuration": "0:00:49",
            "@CallOrigin": "Outbound - Manual",
            "@CallSegment": "Initial",
            "@CallTime": "12/2/2024 5:51:30 AM",
            "@Campaign": "Affiliate",
            "@ContactId": "4274",
            "@Group": "Openers",
            "@InboundPhone": "",
            "@LeadFullName": "Dj T",
            "@LeadId": "42",
            "@ProspectPhone": "+1",
            "@RecordingUrl": "",
            "@Result": "Conversation",
            "@TargetNumber": "+1 5",
            "@User": "",
            "@WaitTime": "",
            "@CallId": "2"
        },
        {
            "@Id": "19267387",
            "@AgentId": "11657",
            "@CallDuration": "0:00:35",
            "@CallOrigin": "Outbound - Manual",
            "@CallSegment": "Initial",
            "@CallTime": "12/2/2024 5:52:54 AM",
            "@Campaign": "Affiliate",
            "@ContactId": "428",
            "@Group": "Openers",
            "@InboundPhone": "",
            "@LeadFullName": "",
            "@LeadId": "4286",
            "@ProspectPhone": "+",
            "@RecordingUrl": "",
            "@Result": "Conversation",
            "@TargetNumber": "+1 ",
            "@User": "",
            "@WaitTime": "",
            "@CallId": "C7"
        },
        {
            "@Id": "19267384",
            "@AgentId": "11",
            "@CallDuration": "0:00:49",
            "@CallOrigin": "Outbound - Manual",
            "@CallSegment": "Initial",
            "@CallTime": "12/2/2024 5:51:30 AM",
            "@Campaign": "Affiliate",
            "@ContactId": "4274",
            "@Group": "Openers",
            "@InboundPhone": "",
            "@LeadFullName": "Dj T",
            "@LeadId": "42",
            "@ProspectPhone": "+1",
            "@RecordingUrl": "",
            "@Result": "Conversation",
            "@TargetNumber": "+1 5",
            "@User": "",
            "@WaitTime": "",
            "@CallId": "2"
        },
        {
            "@Id": "19267387",
            "@AgentId": "11657",
            "@CallDuration": "0:00:35",
            "@CallOrigin": "Outbound - Manual",
            "@CallSegment": "Initial",
            "@CallTime": "12/2/2024 5:52:54 AM",
            "@Campaign": "Affiliate",
            "@ContactId": "428",
            "@Group": "Openers",
            "@InboundPhone": "",
            "@LeadFullName": "",
            "@LeadId": "4286",
            "@ProspectPhone": "+",
            "@RecordingUrl": "",
            "@Result": "Conversation",
            "@TargetNumber": "+1 ",
            "@User": "",
            "@WaitTime": "",
            "@CallId": "C7"
        }
    ]
     
    Regards,
    Sam
     

    _______________________________________________________________________________
    If this is the answer for your question, please mark the post as Accepted Answer.
    If this answer helps you in any way, please give it a like.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 331 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard