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

Community site session details

Session Id : EQbwv6q9yYmuCKTS09aV0U
Power Automate - Building Flows
Answered

concat adding double quotes is adding backslash that makes xpath statement invalid

Like (0) ShareShare
ReportReport
Posted on 21 Nov 2022 04:44:32 by 9

when item()[]ParentPosition] is 1.1 below works:

 

 

xpath(outputs('Compose-XML'),concat('//array[Item = ',item()['ParentPosition'],']/PartNumber/text()'))?[0]

 

 

when item()[]ParentPosition] is is 1.1.1 it does not. I think 1.1.1 requires ". e.g "1.1.1"

Tried below:

 

 

concat('//array[Item/text() = ','"', item()['ParentPosition'] ,'"', ']/PartNumber/text()')

 

 

returns

 

 

//array[Item/text() = \"1.1.1\"]/PartNumber/text()

 

 

how do I remove the \  from \"1.1.1\" so that I have "1.1.1".

wrapping with replace does not work e.g. replace( above, '\','') 

I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,059 Moderator on 21 Nov 2022 at 05:20:33
    Re: concat adding double quotes is adding backslash that makes xpath statement invalid

    Are you able to provide some of the initial JSON or XML you are working with? What you are storing in:

     

    outputs('Compose-XML')

     

    I think it will always show \" as it needs to escape the double quotes. You can try the following instead to give you single quotes.

     

    concat('//array[Item/text() = ''', item()['ParentPosition'] , ''']/PartNumber/text()')

     

  • Wendy_Lumsden Profile Picture
    58 on 03 May 2024 at 15:49:44
    Re: concat adding double quotes is adding backslash that makes xpath statement invalid

    Hi @PaulHancock  - did you resolve this issue?

     

    I am have exactly the same problem, since I am querying an xml with a string id .... which needs double inverted comma's and keep getting errors because power automate adds a backslash before the inverted comma's, which I also tried to remove with replace.... to no avail.

    Any help much appreciated.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 666 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 382 Moderator

#3
developerAJ Profile Picture

developerAJ 254

Last 30 days Overall leaderboard
Loading complete