Good morning,
I am newer to working with Power Automate so please bear with me.
I am trying to create a flow to take some XML code, parse it and apply the data set to a list in SharePoint. I have found this solution to be helpful in the initial creation of the process:
I was successfully able to take out a single data point and push it to a SharePoint list, however, I am running into an issue with how to pull the second set of data into the list, please see the process below:
Compose XML:
In the end, this XML will be pulled from a file dropped within a SharePoint library, but for now we are using this example XML created within the flow.
<?xml version="1.0" encoding="UTF-8"?>
<Party>
<Table>
<Id>4736</Id>
<CompanyId>Target</CompanyId>
<PersonId>1138</PersonId>
<Created>2009-12-31T22:02:52.493Z</Created>
<IsDeleted>false</IsDeleted>
</Table>
<Table>
<Id>4752</Id>
<CompanyId>King Soopers</CompanyId>
<Created>2010-08-24T22:47:44.177Z</Created>
<IsDeleted>false</IsDeleted>
</Table>
<Table>
<Id>4753</Id>
<CompanyId>Wall Mart</CompanyId>
<Created>2010-08-24T22:47:44.177Z</Created>
<IsDeleted>false</IsDeleted>
</Table>
</Party>
Initialize variables
We init the variables for both arrays. (ID and CompanyID)
Run XML through the xPath functions
We run the formula using an xPath function to target each tag.
xpath(xml(outputs('Compose')),'/Party/Table/Id')
xpath(xml(outputs('Compose')),'/Party/Table/CompanyId')
Apply the output to each array & remove tags
We take the output from the previous steps and assign each data point to an array index. We also remove tags here using replace
replace(replace(decodeBase64(item()?['$content']),'<Id>',''),'</Id>','')
replace(replace(decodeBase64(item()?['$content']),'<CompanyId>',''),'</CompanyId>','')
Compose
We take the data from each Apply to Each and compose it to a variable.
Apply to each / Create SharePoint Item in List
We perform an Apply to Each, bring in the composed variable, and assign it to a single field. This is where I cannot assign the Company ID data to a column on this list.
Here I can apply the array as an output, but not loop through the array to apply each data point to a column. How can this be accomplished?
Final result
As you can see, each XML ID can through into each row. However, since I can't do another Apply to Each from the Company ID output, I cannot loop through the array.
Thank you for any help in advance! Please let me know if I can provide any additional details.
Solved! Go to Solution.
Hi @Anonymous ,
It seems that you have posted a similar question here:
Best Regards,
Hi @Anonymous ,
It seems that you have posted a similar question here:
Best Regards,
User | Count |
---|---|
92 | |
45 | |
21 | |
18 | |
16 |
User | Count |
---|---|
136 | |
49 | |
42 | |
36 | |
28 |