Creating folders and hierarchies when using the Publish to Tableau Server tool in Alteryx
If you use Alteryx & Tableau together you certainly have workflows running the “Publish to Tableau Server” tool. This macro makes it easier to send the output from a workflow in Alteryx to Tableau, allowing the users to automate tasks and keep data that needs preparation always fresh in Tableau server.
In its latest versions, the Publish to Tableau Server tool appeared with a new functionality: publish also metainfo together with the dataset. It allows to organise the fields into folders and to create hierarchies in the data that then will be available to everyone who can connect to it in Tableau Server – a great way to make your datasets more user friendly.
To do it, instead of publishing a hyper file or tde only, Alteryx publishes a tdsx (Tableau Data Extract) to Tableau Server. In a few words (and totally simplifying it), imagine that the tdsx is a folder containing not only the data file (hyper or tde) but also instructions about how to read it (more about it here ).
In those instructions you can, for instance, tell Tableau to organise fields X and Z together inside a folder, or instruct Tableau to create a hierarchy between them.
How to create a tdsx using the Publish to Tableau Server tool
By default the Publish to Tableau Server tool creates hyper files or tdes. However, using the “Data source meta-info” option it’s possible to send a tdsx instead.
It is a simple but tricky process if you have never done it before. First of all, you should create a normal hyper file using the output tool and saving it locally in your computer.
Open this file using Tableau Desktop and do all the changes you would like to have available to the end user. Add the folders or hierarchies. When you are happy with the result, save the data only, not the full workbook. You do it in ‘Data’ and ‘Add to Saved Data Resources’.
Tableau will add the new file to the “My Tableau Repository” folder (usually it is in the “Documents” folder of your computer). Navigate into it and select the “Datasources” folder. Inside it you should find the new file.
Now you need to open this file with a text editor (Notepad if you are a Windows user or TextEdit if you are in a Mac are fine). Right click the file and choose “open with”. Select the text editor of your choice and open the file. You should see the code of your tds.
There are only two small changes you should do: change the version of the server (on my case I’m changing from the 18.1 version on Desktop to 10.5 on server) and change the path in “dbname”. Datasource paths in Tableau Server point to “Data/Extracts/[filename].hyper”.
Save the changes and go back to Alteryx. Drag and drop the Publish to Tableau Server and configure it using the “Data source meta-info” option. The only thing you need to do is to click on this field and browse the tds file.
Finally, run the workflow and then check on Tableau server your new dataset. You can open it using web editor to make sure you can see all the changes you have made.
That’s all. Now all the times you run your Alteryx workflow, it will send the new data to Tableau Server keeping this same structure!