Skip to main content

Notifications

Community site session details

Community site session details

Session Id : nfrDd6tkokM9/MaT3bFbLb
Power Automate - Power Automate Desktop
Unanswered

XML xpath expression to get sum

Like (0) ShareShare
ReportReport
Posted on 6 Apr 2021 14:13:40 by 37

Hi Team,

 

I have been trying to execute an XPath expression in order to get the sum of a few nodes but it returns an "invalid XPath expression"

 

Below is the sample xml 

"<Xavor>

<Dev>
<NewNode1>1234</NewNode1>
<Emp>1</Emp>
<Floor>1</Floor>
<Salary>1200.4</Salary>
</Dev>
<Dev>
<NewNode1>1234</NewNode1>
<Emp>123</Emp>
<Salary>3</Salary>
</Dev>
<Dev>
<NewNode1>1234</NewNode1>
<Emp>3</Emp>
<Salary>1000</Salary>
<Floor>1</Floor>
</Dev>
<Dev>
<NewNode1>1234</NewNode1>
<Emp>4</Emp>
<Salary>3</Salary>
</Dev>
</Xavor>"
 
Xpath query expression I have used:- SUM(Xavor/Dev/Salary)
 
Please help to correct any syntax I have missed.
 
Thanks 
Aditya
Categories:
  • fraenK Profile Picture
    2,125 on 07 Apr 2021 at 06:53:03
    Re: XML xpath expression to get sum

    Please post the full error message!

     

    It seems like PAD only supports retrieving nodes and its attribute values, not calculated values.

    So you need to get all desired node values first as a list and then process this list for calculation.

  • Aditya_93 Profile Picture
    37 on 07 Apr 2021 at 05:30:06
    Re: XML xpath expression to get sum

    I have tried the above path expression, but it's still giving me error as "invalid XPath expression"

    Can you please help me?

  • yoko2020 Profile Picture
    495 on 06 Apr 2021 at 17:29:55
    Re: XML xpath expression to get sum

    Try this

     

    sum(/*/Dev/Salary[string(number(.)) != 'NaN'])

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started