5 Replies Latest reply on Apr 17, 2018 6:50 AM by Baxter Boe

    Tableau Extensions API (Beta) -- Write Back from Extension to SQL Server

    Baxter Boe

      I have a dashboard extension that is an HTML Form with 3 input fields.  Currently it is hosted on npm locally and the javascript saves the values using SaveAsync()  and renders them in a table in the Extension UI and clears them when the hit the "Clear" button and saves them when they hit the "Submit" button.  What is the appropriate way to Save these values in a SQL database on the "Submit" action. I've tried the all of the following ways but can't get it to work locally...  Do I need to load the dashboard with the extension to the SQL Server (Beta) first and call the REST API for the underlying metadata?

       

      Regardless of these, what is the recommended architecture and process for writing back to SQL Server from a dashboard extension.  There may be more than one right answer....

       

       

      Jquery/AJAX  in the .Js file ==> .PHP (WampServer) ==> MySQL

      Powershell ==> SQL Server

        • 1. Re: Tableau Extensions API (Beta) -- Write Back from Extension to SQL Server

          Hi Baxter,

           

          There is no way to write back in the database with Tableau, however you could use URL actions that submit the wanted values to a PHP Web Service. The latter will insert those values into the database. You have a great example of the PHP code for this here, from Aaron Clancy - Re: Can Tableau write data back to the data source?

           

          Do I need to load the dashboard with the extension to the SQL Server (Beta) first and call the REST API for the underlying metadata?

          That would be the best way to proceed. have you tested this yet?

          Do you have an error when you try to submit?

           

          ----------

          Lénaïc RIÉDINGER, Global Community Engineer Tableau

          Tableau Community Forums | Knowledge Base

          If you see a Helpful or Correct response, please mark it thanks to the buttons below the targeted post!

          • 2. Re: Tableau Extensions API (Beta) -- Write Back from Extension to SQL Server
            Joe Crowther

            I'm confused. One of the main benefits of the new Extensions API touted at TC17 was the write-back functionality it would allow. Also, on the product page here it specifically says:

             

            Extensions API

            With our Extensions API, developers can create dashboard extensions that enable customers to integrate and interact with data from other applications directly in Tableau.

            Use Cases:

            • Create an extension that has write-back functionality, so users can modify data in a viz and have that change automatically update the source data in the data base or web application
            • Build custom viz and interactivity types such as a filter replacement with a custom interface and network diagram
            • Integrate 3rd party functionality inside the dashboard

            Benefits:

            • Interact with data from other business applications directly in Tableau
            • Customize Tableau's Desktop environment for a specific team's workflow

            Level of Support:  Tableau-supported once released

            1 of 1 people found this helpful
            • 3. Re: Tableau Extensions API (Beta) -- Write Back from Extension to SQL Server
              Toby Erkson

              This is new territory so I would recommend contacting Tableau Support.  These forums are not Tableau Support, they are supported predominantly by volunteers.

              • 4. Re: Tableau Extensions API (Beta) -- Write Back from Extension to SQL Server
                Keshia Rose

                Hi Joe,

                 

                You are correct, with the new Extensions API you will be able to create an extension that enables your users to write back to a database or file. The method (JS, PHP etc.) is up to you once your user hits submit. I found a write back extension (currently in development) written by Andre de Vries that writes back data to a text file. Not exactly your use case but hopefully it can get you going in the right direction!

                 

                GitHub - andre347/tableau_extension_writeback: Tableau Extension for writing back to local file

                 

                Take care,

                Keshia

                • 5. Re: Tableau Extensions API (Beta) -- Write Back from Extension to SQL Server
                  Baxter Boe

                  I have a working dashboard Extension that writes back to a SQL database.  Everything is hosted locally.

                   

                  Client side -- used HTML, Java Script, Node.js and NPM (Local)

                  • HTML form -- defines the form field inputs and form action as POST Method
                  • JavaScript -- grabs the inputs and sends them via AJAX POST Method as a JavaScript String to a WCF Web Service and also refreshes the data source
                  • Application uses Extension API (12.7.0), Favicon.ico,  Node.JS, JQuery, and NPM

                   

                  Server Side -- Uses WCF Web Service created and hosted locally in Visual Studio 2017 to receive the data and TSQL statement to insert data into a table

                  • SQL Database -- Write a TSQL statement that creates a new data base
                  • WCF Web Service is hosted using IIS Express in Visual Studio.  It creates a local endpoint that can be called in your JavaScript AJAX post above.
                  • WCF Web Service TSQL Insert statement writes the data to the database

                   

                  Tableau/Data source Side -- your write back table and tableau data source are set up as individual tables in one Database

                  • Connect Tableau to the SQL data base in tableau
                  • Create a data source that joins your superstore data with the write back data
                  • Connect live to this data source
                  • Drag the extension object onto your dashboard
                  • Enter new products into the extension and use the refresh data source button to present updates live in tableau