Occasionally customers ask if they can update data in their databases from inside #Tableau. While the tool doesn’t support this functionality directly, there are a couple of ways to get there.
Ryan Robitalle created an excellent example of doing so using a data entry grid embedded into a Tableau dashboard:
…and here’s another technique.
It involves calling a “RESTful web service” from inside Tableau to make the changes for us.
In our case a RESTful web service is a very handy thing because we can call it with a URL like:
That looks like something we could stick into a URL Action, doesn’t it?
Here are the basics of how you might approach the problem of being able to update an employee’s misspelled name (stored in a database) while inside Tableau:
Create a web service that can update your employee table based on an employee id and an updated employee name. The link you execute to do this work might look like this:
The URI above would update the name for employee #3 to “NewName”.
Add a parameter to your dashboard that can accept user input
Create a URL Action which calls the URI above, dynamically adding the Employee ID and parameter value (updated name) to the URI.
Add a Web Page object to your dashboard to avoid new browser windows opening when the URL gets executed.
Bask in the glory heaped upon you by your co-workers.
…and here’s a video showing all the parts working together.
I’ve also attached a sample, which includes:
- A sample Web Service (Microsoft .NET WCF – Visual Studio 2010 / C#)
- A sample database
- A sample Tableau report