web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

Count XML items

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone,

is there a way to count the number of items in Power Automate Desktop with xpath.
In my example I would like to know how many articles there are and then use this value for a loop.

 

 

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<Messages>
 <Message>
 <MessageStandard>TESTXML</MessageStandard>
 <MessageType>8</MessageType>
 <Sender>Michael</Sender>
 <IsTestMessage>N</IsTestMessage>
 <Article>
 <LineNumber>0001</LineNumber>
 <ArticleDescription>Test-Article 1</ArticleDescription>
 </Article>
 <Article>
 <LineNumber>0002</LineNumber>
 <ArticleDescription>Test-Article 2</ArticleDescription>
 </Article>
 </Message>
 </Messages>

 

 

Cartis_0-1660216415574.png

 

 

I already try it with a xpath expression.

 

count(//Article)

 

Thank you and best Regards

 

Cartis

I have the same question (0)
  • Verified answer
    Kaif_Siddique Profile Picture
    2,108 Super User 2024 Season 1 on at

    Hi Cartis,

     

    You will need to change the xPath query. In your case you want to count the <Article> so you can navigate like "Messages/Message/Article" as per your xml file and get the output using "XPathResults.Count". Please refer below for more details.

     

    Kaif_Siddique_0-1660239391007.png

    ---------------------------------------

    Thank you and hope it can help you.

     

    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Kaif_Siddique,

     

    Thank you very much.

    I had no idea how simple it was.

    You helped me a lot with this, thank you very much.

     

    Best regards

    Cartis

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 298 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 150 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 147 Super User 2026 Season 2

Last 30 days Overall leaderboard