Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Retrieve Table name from a TWB file

vishantshenoy
7 - Meteor

Hello Alteryx Experts,

 

Please note I am new to Alteryx and am looking for help to read Metadata from TWB file.The issue that I am facing is I am not able to get table for a column which is available in datasources tag of the TWB XML file. If anybody could point me in the right direction would really be great.

 

Thanks in advance.

 

Best Regards,

Vishant

16 REPLIES 16
grazitti_sapna
17 - Castor

Hi @vishantshenoy , can you please provide a sample file to investigate?

 

Thanks.

Sapna Gupta
vishantshenoy
7 - Meteor

Hi @

 

Please note I am unable to upload the TWB file proprietary data or files cannot be uploaded.

 

To give you more information about the issue, the Tableau Workbook from which I am trying to get Metadata is connected to Ms SQL Server DB. The data source has two tables joined with common fields in Where clause.

 

When I run the attached workflow it gets the most of the info like column name, datatypes, calculated field names and calculation  string, except for the table name which appears null.

 

But if include only one Table in the Tableau datasource and execute the workflow, the table name field is populated without any issue.

 

So it looks like is data source has two or more tables, the workflow is unable to get table name. But with one table it works perfect.

 

 

Let me know please if you need any other information.

 

Thanks,

Vishant

Thanks.

 

grazitti_sapna
17 - Castor

Hi @vishantshenoy, not sure if this will work for you but I had a sample twb file it worked for me in case you are only trying to fetch table name.Please have a look at the configuration

 

1)

grazitti_sapna_0-1602147430869.png

 

This will result in worksheet outerxml includes all the details about a worksheet.

 

2) Then I parsed worksheet_outerxml using this configuration resulting in table or extract name used in that particular worksheet.

grazitti_sapna_1-1602147477877.png

 

grazitti_sapna_2-1602147534392.png

 

3) Then I further parsed worksheet_outerxml for column types and details.

 

grazitti_sapna_3-1602147568459.png

grazitti_sapna_4-1602147580048.png

 

 

I hope this helps.

 

Also, if this is what you were trying to achieve then kindly mark this post as solution.

 

Thanks.

 

 

 

 

Sapna Gupta
vishantshenoy
7 - Meteor

Hi @ 

 
As per your suggestion, please note I made the following change o file input configuration.
 
 

1)

Screen1.PNG

 

2) Once the above change was made, the XMl parser doesn't list worksheet_Outerxml, please refer to

screenshot below.

 

I will try to share you a link to sample TWB file which is available in Tableau site. The issue is with TWB 

which has more than one table in data source. With a single table am able to retrieve table name but the issue

happens with more than one table joined in datasource.

 

Please try with the TWB file available in this GitHub link:-

https://github.com/tableau/TabMon/commit/d493abfd181a0c913b21b4fb4bec0c57da399983#diff-1cef4ab71264c...

 

 

Screen2.png

 

Thanks,

Vishant

grazitti_sapna
17 - Castor

Hi @vishantshenoy , please refer to the screenshot and workflow attached below.

 

grazitti_sapna_0-1602155116487.png

 

Sapna Gupta
grazitti_sapna
17 - Castor

Hi  @vishantshenoy, I have downgraded the version of the file but keep this file and the input file at same location or if you change the inputfile  then use this config.

grazitti_sapna_0-1602158779933.png

 

Thanks.

 

 

Sapna Gupta
vishantshenoy
7 - Meteor

 

Not sure if I am I doing something wrong, the packaged workflow and TWB file are in same folder "C:\Vishant\Tableau Audit Tool\TEMP"

 

But I get an error :- The field "worksheet_outer_WML" is not contained in the record. Please let me know if something has been missed out:-

 

Screen3.PNGScreen4.PNG

 

 

 

 

vishantshenoy
7 - Meteor

Hi,

 

Please note if you open the TWB XML file the data source has couple of tables. These tables are not being listed with their corresponding columns in final output. The challenge here is to get the table names when multiple tables are joined. With one table in data source there is no issue. Please let me know if you find any solution.

 

<relation connection='postgres.42271.475394699075leaf' name='Actions' table='[public].[historical_events]' type='table' />
<relation connection='postgres.42271.475394699075leaf' name='Action Types' table='[public].[historical_event_types]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Data Sources' table='[public].[hist_datasources]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Groups' table='[public].[hist_groups]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Schedules' table='[public].[hist_schedules]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Target Site' table='[public].[hist_sites]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Actor Site' table='[public].[hist_sites]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Target User' table='[public].[hist_users]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Tags' table='[public].[hist_tags]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Tasks' table='[public].[hist_tasks]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Comments' table='[public].[hist_comments]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Views' table='[public].[hist_views]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Projects' table='[public].[hist_projects]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Workbook' table='[public].[hist_workbooks]' type='table' />
</relation>
<relation connection='postgres.42271.475394699075leaf' name='Actor User' table='[public].[hist_users]' type='table' />
</relation>

grazitti_sapna
17 - Castor

Hi @vishantshenoy , as I can see in the screenshot in your case you are using preference_outer_xml, so there might be a difference in the xml code. try replacing worksheet_outer_xml with preference_outer_xml and then  the process or if possible could you send copy the first cell of preference_outer_xml and send it in a notepad to investigate further?

Thanks.

Sapna Gupta
Labels