cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DT5
New Member

XML import issue with multiple parents/grandparents

Hi all,

I think there is a simple answer to this but I can't quite figure out what I need to change to fix this flow.

 

I have a flow that successfully picks up an XML file and creates items in a sharepoint list from the <amount> and <narrative> xml children of <transaction>. Example XML as follows:

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
                <transactions>
                        <transaction type="C" code="TFR" status="C">
                                <amount currency="GBP">1.00</amount>
                                <narrative>Trans 1</narrative>
                        </transaction>
                        <transaction type="C" code="TFR" status="C">
                                <amount currency="GBP">2.00</amount>
                                <narrative>Trans 2</narrative>
                        </transaction>
                </transactions>

 

 

Output in sharepoint list:

image.png

However to get the above working in power automate I had to remove a number of parent/grandparent items from the XML file - which were <statement>, <account> and <transactions> and some siblings too - below is the original xml I want to use in my flow

 

 

<?xml version="1.0" encoding="UTF-8"?>
<statement xmlns="web address removed" xmlns:xsi="web address removed" xsi:schemaLocation="web address removed web address removed" type="EXPORT" customerId="00000" date="2021-02-03">
        <account currency="GBP">
                <name>Example Name</name>
                <number type="STANDARD">000000</number>
                <source type="SC">000000</source>
                <transactions>
                        <transaction type="C" code="TFR" status="C">
                               <amount currency="GBP">1.00</amount>
                                <narrative>Trans 1</narrative>
                        </transaction>
                        <transaction type="C" code="TFR" status="C">
                                <amount currency="GBP">2.00</amount>
                                <narrative>Trans 2</narrative>
                        </transaction>
                </transactions>
        </account>
</statement>

 

 

 

This is the flow that works with the 1st xml example:

image.png

xpath formulas are:

Apply to each: xpath(xml(outputs('Compose')),'//transaction')

Id input: xpath(xml(item()),'string(/transaction/amount)')

CompanyId input: xpath(xml(item()),'string(/transaction/narrative)')

 

 

If I don't modify any of this code the flow 'succeeds' because it doesn't recognise there is any data to populate. If I try and adjust for the additional parents (which I think I'm doing wrong) I get this error:

image.png

Instead of trying to explain/show what I was doing to try and account for the other parents/grandparents, I'd be grateful if someone can advise what I need to change in order to be able to run the flow with the 2nd xml example file.

 

Many thanks!!

0 REPLIES 0

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,803)