Monday, May 4, 2015

New Tableau Tool – Reset Field Names

This tool was prompted by this Tableau community forum discussion: In 8.2 - how do I stop Tableau from renaming all my fields?

The person who posted the original discussion was complaining that Tableau was automatically renaming the fields upon first connection to the data, e.g. the field was_this_visit_callable was renamed Was This Visit Callable.

The behavior was introduced in Tableau 8.1 (per Tableau support via Tom W).

It's not unreasonable to think that renaming fields from their technical names to user-friendly names has value, particularly in those environments where the database people don't want to, or can't, give human-oriented names to the database fields. But there are circumstances where it's not appropriate and when done forces people to either live with field names they'd prefer not to have, or exert the time, energy, and effort to undo the changes Tableau automagically made.

Adjusting field names to make them more human-oriented isn't in itself a bad thing, but Tableau's implementation of the feature is lacking in several important ways, including:

  • it happens invisibly—Tableau changes the names without informing the person who connected to the data that it's done so;
  • it's an imposed functionality without an opt-out ability—there's no mechanism whereby the User can choose for this to happen, or not;
  • there's no way to control the adjustments that Tableau makes, which are (at least, and in this order)
    • replacing underscores '_' with blanks '  '
    • upper-casing the first letter of each discrete word

We can't fix Tableau but we can fix the names.

is a Tableau Tool that will find all of the renamed fields in your workbooks and remove the customized names, leaving the database names as the ones the User sees.

About ResetFieldNames.rb:
  • It's written in Ruby and is available from GitHub here.
  • It uses the Twb Ruby gem, available via RubyGems.
  • It's surprisingly small, only 34 functional (not comments) lines.
  • Is run from the command line:
    ruby ResetFieldNames.rb
  • Will reset the field names in selected Workbooks:
    • by default – all of the Workbooks in the current directory;
    • the Workbooks can be identified on the command line, e.g.:
      ruby ResetFieldNames.rb 'some*.twb'
      using file patterns to identify groups of fields.
  • Will not reset Calculated field names; although they have technical and User names, they aren't database fields and their technical names are undecipherable for normal humans.
  • By default writes the reset fields to a copy of the original Workbook with '.reset' appended to the Workbook's name, e.g.
    Science.twb -> Science.reset.twb
    this can be changed so that the Workbook will be replaced when written, or other text can be provided for appending.
  • The reset fields will be recorded in the CSV ResetFields.csv with the fields:
    Workbook,Data Connection,Field Name,Field Caption
    making it easy to determine which fields were changed, in which Workbooks.

Considerations and potential enhancements.

ResetFieldNames resets all the fields to their database names. It would be really helpful if the fields could be selectively reset, making it easier to get them configured just right. There are many ways to accomplish this, one easiest and most transparent method would be to use an Excel/CSV file as the input identifying the field names to reset.

Considerations and potential enhancements.

Please add your comments here, or to ResetFieldNames.rb's Tableau Tools wiki page on GitHub

I hope you find this Tableau Tool useful and valuable.


  1. would it be possible, not only to reset alias, but also to implement a kind of alias / metadata management? For column alias and element alias?

    In the twb section a column has a "name" (key?) and a "caption" (alias?)
    And dimension elements can have aliases with "key" and "value"

    I am living in the Microsoft SSAS world where relational tables can be used to implement translations.

    My idea would be:
    - optional: to extract used alias for columns and element on one side (more for documentation)
    - to write alias for columns and elements into the twb file.

    In this case all could be prepared in a database (translation tables, ...), and depending on the required language it would be easy to make a copy of the twb for a new language and to fill this copy with alias for a specific language. Or it would be possible to update the element alias when they change or when new elements are added.

    1. Hi Germo - for the first part, there are ways now to extract and manage custom field names. Extracting has been part of TWIS since its inception, Andy Cotgreave's Tableau Workbook Auditor also does it (I think), and it's part of lots and lots of little tools I've put together, some of them published here, others available as Tableau Tools.

      Building a reasonably functional and robust name/alias management app isn't that far off from a number of the custom solutions I've built in the past, mostly for specific client needs. It would be an interesting exercise to pull one together, particularly given that a lot of the heavy lifting of Workbook interrogation and management is built into the Tableau Ruby gem.

      If you're interested in working on one, under the aegis of Tableau Tools, I'd be interested in collaborating - unfortunately I don't have the spare time at present given my other projects.

      If it's something you want or need and there's some funding available, my firm creates bespoke custom Tableau apps, mostly based upon the Tableau Tools foundation (which means that anything created from them needs also to be open source licensed).