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
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
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.
- 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:
- 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
with the fields:
Workbook,Data Connection,Field Name,Field Caption
making it easy to determine which fields were changed, in which Workbooks.
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.
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.