Monday, May 11, 2015

New Tableau Tool - Extract and Record Field Comments

It was a dark and lazy evening. Nothing much happening. Then things got Interesting. Inspiration knocked on the door, and without waiting for Invitation walked right in.

Seems that Tableau's been keeping some information to itself: comments. Comments about Fields. Information that could, in the right hands prove very useful, even valuable. Inspiration wanted me to come up with a way to get Tableau to give up its comments, and who can resist Inspiration?

The thing is, Tableau doesn't give up its secrets easily. Sure, you can open up a Workbook, then a Worksheet, pick a Data Source, right-click on a Field, navigate down into its menu items and convince it to fess up, spill the beans, give up the goods, sing. But this isn't efficient, and it makes is hard to get the whole story, the straight dope, the full shenanigan. Looking as isolated comments is no way to build a comprehensive integrated overview of the entire metadata landscape.

It didn't take much coaxing; I always was a sucker for an insistent Inspiration. So I pulled out my trusty Twb gem and whipped up a brand spanking new Tableau Tool—ExtractFieldComments.rb, custom crafted to scan a set of Workbooks and locate and record the comments for all the fields that have them. Didn't take long, I was eager to get back to finding out what Inspiration had in store for me next.

Get it here
at Tableau Tools on GitHub:

ExtractFieldComments.rb in action.

Here's what it looks like when it's run in a directory containing the Tableau Sample Workbooks from versions 8 and 9:

As we see, ExtractFieldComments.rb walks through the Workbooks. While it doing so it's showing the different Data Sources as they're encountered. It's not showing the Fields as they're examined–doing so would produce too much output with too little information–but it's recording all the Fields that have comments, along with those comments into the CSV file TT-FieldComments.csv.

Being a CSV file, TT-FieldComments.csv can easily be opened and analyzed with Tableau. Which is, after all the point.

Understanding the Comments

This Tableau Public published Workbook provides a sampling of the ways in which the comments for your Workbooks can be collected, organized, analyzed, and understood. And all comments want to be understood. One of my mentors was fond of saying: "There aren't any bad comments, just some that are misunderstood."

What's next?

There are plenty of additional Tableau Tools in the pipeline. Many of them are versions of scripts I've published here reworked to take advantage of the Twb gem. Some of them are brand spanking new. I'd really like to hear any ideas from the community about useful tools. And I'd really like it if anyone else want to take a stab at building your own Tableau Tools — that's what the project's all about.

1 comment:

  1. Perfect, Thanks for sharing. It is possible to comment out lines of a calculated field, You can comment out the whole line, or even add a comment to the end of a line. Read more to know more about commenting lines in calculated field (Tableau).