cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Laser_Tim_88
Advocate II
Advocate II

Extracting Info from XML and Nested XML files

Hey all, Sorry for such a long post.

 

I work in manufacturing, and I am coming from WinAutomation, so I am not too familiar with the ins and outs of Power Automate. I am hoping this community can help me and give me guidance on simplifying or reworking steps in my flow to make it easily understandable and more efficient.

 

As you can see in the first picture >> a PDF triggers the flow >> get the contents of the PDF >> Call a child flow. The child flow extracts the contents of an XML file that is in a different directory but associated with the PDF that triggered the flow. It returns JSON that provides details about the production page and each image that is on the page.

Picture_1Picture_1

 

As highlighted in the orange rectangle in the first image, there is an image on the page where the name starts with “Nested Wood”. See, I have learned to nest images inside of other images to make better use of our material and the software I am using also creates an XML file for those nested images.

 

Below, I filter all the normal images on the page from the “Stamp Info” array and store them in the Image List Variable.

Then, I filter the same array but only if it contains the string “Nested Wood”.Picture_2Picture_2

 

Just like at the beginning of the flow, I have to send each of the “Nested Wood” images through the same Child flow to extract the XML content.  

Picture_3Picture_3

Then I loop through each image within each “Nested Wood” and add that Image to the Image List Variable.

Picture_4Picture_4

 

After those steps I have all the info I need, and I will add that info to a share point list next.

 

Before I do that though I am here to see if I can cut down on actions or if there are any other functions within expressions that I may use to tidy up the process.

I am sorry for such a long post, but I wanted to be detailed enough so that it could be understood.

Thanks in advance for the help and having me in the community.

1 ACCEPTED SOLUTION

Accepted Solutions
ManishJain
Solution Sage
Solution Sage

Hi @Laser_Tim_88 ,

 

You are on track, just in last loop use the compose action to put the data instead of adding to list. When you are doing the compose inside loop it is internally adding to an array. This array can be accessed outside foreach loop. 

All you have to do is add one more compose outside foreach loop and use expression Outputs('Compose{}'). Please note 'Compose{}' is a variable you defined in Foreach loop.  Plus if you want to speed up last loop you can right click on the loop and select settings and choose concurrency of your desired choice.

Thanks

View solution in original post

3 REPLIES 3
ManishJain
Solution Sage
Solution Sage

Hi @Laser_Tim_88 ,

 

You are on track, just in last loop use the compose action to put the data instead of adding to list. When you are doing the compose inside loop it is internally adding to an array. This array can be accessed outside foreach loop. 

All you have to do is add one more compose outside foreach loop and use expression Outputs('Compose{}'). Please note 'Compose{}' is a variable you defined in Foreach loop.  Plus if you want to speed up last loop you can right click on the loop and select settings and choose concurrency of your desired choice.

Thanks

@ManishJain 

Thank you for the reply and suggestion about the compose action instead of the Append to List. I wasn't aware that being in a loop that the compose would automatically append to the array! I will also be taking advantage of the concurrency settings.  

Thanks again!

Hi @Laser_Tim_88 ,

 

Please go ahead and close the ticket by marking as a solution.

 

Thanks

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,584)