Hi all. I'm trying to automate some tasks with Tableau. Basically the flow is:
I got pretty much everything worked out and working but I really don't like how I get the token out. Currently I'm using a convoluted mix of Search() and Substring() to extract it. I would love to use XPATH as its a lot easier to implement and I'm always game to learn new things.
Here is the XML data that is returned by the logon request:
<?xml version='1.0' encoding='UTF-8'?> <tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-3.6.xsd"> <credentials token="THIS IS TOKEN"> <site id="THIS IS SITE" contentUrl=""/> <user id="THIS IS USERID"/> </credentials> </tsResponse>
From this I would like to extract the following string "THIS IS TOKEN" using XPATH. I used this tool to test the XPATH expression and this seems to work "string(/tsResponse/credentials/@token)"
The issue is running it into flow. Initially I was using the HTTP request action but I didn't want to make too many requests so I created a mockup where I paste a sample payload into a Compose action and have a second compose action that executes the XPATH.
This is the expression I use on the second Compose action where "Compose 2" has the text"
Here is the result of the flow.
I've tired a few other XPATH examples from online and they seem to work but I just can't get this to function correctly. Any idea what I am doing wrong?
Solved! Go to Solution.
Hi @RTW ,
Please try to refer to the following method to configure Flow:
In addition, you can follow the link and get more details about the XPath() function:
@abm Thank you, this worked.
I had to modify it slightly to xpath(xml(outputs('Compose_2')),'string(//*[local-name()="credentials"]/@token)') to get the correct output.
So, that being said, what did I do wrong?
Check out the on demand sessions that are available now!
ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.
Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!