Hello!
I have an XML file which I want to parse to an e-mail message.
...
Action: Data Operation -> Compose: Produtcnames
xpath(xml(outputs('ValidXML')), '/invoice/items/item/productname')
Action: Control -> Apply for each: Apply for each product name
Selected output: outputs('Productnames')
Action: Variable -> Increment variable: Increase product ID
Name: ProductID
Value: 1
Action: Variable -> Append to array variable: Add to productsArray
{
"No.:": @{variables('ProductID')},
"Product": @{replace(replace(decodeBase64(item()?['$content']),'<productname>',''),'</productname>','')}
}
The code above is working fine but I have an another step:
Action: Data Operation -> Compose: ProductPrices
xpath(xml(outputs('ValidXML')), '/invoice/items/item/productprice')
So I would like to modify
Action: Variable -> Append to array variable: Add to productsArray
{
"No.:": @{variables('ProductID')},
"Product": @{replace(replace(decodeBase64(item()?['$content']),'<productname>',''),'</productname>','')},
"Price": @{replace(replace(decodeBase64(item()?['$content']), '<productprice>', ''), '</productprice>', '')}
}
But only the item() function can not be changed to
replace(replace(decodeBase64(outputs('ProductPrices')?['$content']), '<producprice>', ''), '</producprice>', '')
<?xml version="1.0" encoding="utf-8" ?>
<invoice>
<items>
<item id="5">
<productname>Product one</productname>
<productprice>1000</productprice>
</item>
<item id="7">
<productname>Product two</productname>
<productprice>9000</productprice>
</item>
</item>
</invoice>
Proud to be a Flownaut!
I have edited my post.
Thanks in advance.
Proud to be a Flownaut!
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
19 | |
12 | |
9 | |
8 | |
4 |
User | Count |
---|---|
23 | |
14 | |
12 | |
12 | |
10 |