19
SEP
2018

Tableau Extension API – Write Back – Updated Source Code for Tableau 2018.2

Kommentare : 50

 

 

 


 

 

LATEST VERSION OF THIS WRITE BACK EXTENSION => CLICK HERE

 

 


 

 

 

 

Due to the Google Analytics analysis I’ve done for the current quarter one can easily see that you – the Tableau community which we call “Tableaufans” – have been asking for more write back content. Would you agree?

So as a very first step I’m going to attach a quick tutorial around how to get “Tableaufans-WriteBack-2018.2” up and running for Tableau’s latest release (2018.2) and above. If you haven’t heard about “Tableaufans.com’s Write Back Extension” yet, you might want to watch the ~4min video from one of the previous posts to understand what you could get by following these steps.

  1. In order to be able to leverage the write back extension you need to have a webserver and a MySQL database
    1. I’m using XAMPP version 7.0.23 which contains both. You can download it here.
    2. Once you’re done downloading it you can extract the folder directly into C:
      (By copying it directly into C: it would simply allow you to follow all of my tutorials around extensions and JS API just a little bit easier in the future.)
    3. Start “C:\xampp\xampp_start.exe” as administrator
  2. Download the latest extension-api-master here: https://github.com/tableau/extensions-api
  3. Extract the content and paste it into your webserver (C:\xampp\htdocs)
  4. Extract the zip below and create a new file path where you extract it’s content into:
    Tableaufans-WriteBack-2018.2.ServerLogic(HTML,PHP,JS,CSS,)
  5. Extract the *.trex file and copy it into C:\Users\<USERNAME>\Documents\My Tableau Repository\Extensions
    Tableaufans-WriteBack-2018.2
  6. Make sure your XAMPP (Webserver+MySQL database) is up and running
    1. Apache should use port 8888
    2. Mysql 3306
      -> (If this is not the case, please change your ports accordingly as it will help you to use more assets from Tableaufans.com in the near future)
  1. MySQL should have a database called ‘yoursqldb’ with a table ‘getdataandwriteback’:
    (if not, please use ‘yoursqldb.sql’ attached to create the table within a database called ‘yoursqldb’)
  2. Add a new user to MySql (direct link to the right user interface on MySql)
    1. User name: admin
    2. Host name: localhost
    3. Password: admin
    4. Re-type: admin
    5. Privileges: Data, Structure & Administration
  3. Extract and Open “Tableaufans-WriteBack-2018.2.twbx.zip” with Tableau Desktop
  4. Drag and drop extension into the canvas and choose the one you copied into C:\Users\<USERNAME>\Documents\My Tableau Repository\Extensions
  5. Allow data access to the extension:
  6. Choose “Pipeline” as sheet to choose data selections from:
  7. Happy write back your data 😉

 

 

Troubleshooting:

  • If the data doesn’t get written into the database make sure that you’ve got a user called “admin” in MySQL with password “admin” with the following permissions:
    • http://localhost:8888/phpmyadmin/server_privileges.php?db=&viewing_mode=server
    • http://localhost:8888/phpmyadmin/server_privileges.php?username=admin&hostname=localhost&dbname=&tablename=&routinename=
  • If you want to debug Tableau Extensions generally you might want to have a look the following 2:21 min tutorial

    Start Tableau Desktop (with Extension in Debug Mode).bat
  • If you’re having any troubles in getting the extension up and running please leave us a comment below.
Timo Tautenhahn
Über den Autor
Timo originally coded his own BI-application by making use of different JAVA libraries. He Worked for IBM as BI-specialist and BA-architect before he joined Tableau. Favorite subject: JavaScript API
  1. Timo Tautenhahn
    Timo Tautenhahn Reply

    Hey Tableaufans,
    I’ve just updated the tutorial. ! In the alpha version of Tableau’s Extensions I’ve been zipping my whole Xampp where the admin user did already exist. As this tutorial should work for everyone I’ve extended this post by describing how to create the admin user.

  2. Avatar
    Adrien Reply

    Hi Timo,

    We met a week ago and you showed us this capability. It is brilliant, I followed all the steps but at the moment, we use tableau 10.5. is there any limitation to use tableau extension? Which version do I need? if not, could you share the tableau workbook in previous version?

    thanks for your help
    Adrien

  3. Pingback: » Tableau Extension API – Write Back

  4. Avatar
    Sam Reply

    Hi Timo
    We use 10.5 as of now on my complany server but I have 2018 installed on my local machine,
    Would it be possible to install the writeback for me on my local machine with above steps ??

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hey Sam,
      yes, if you’re using Tableau Desktop 2018.2 or above you can absolutely use it locally with the steps above! 😉

  5. Avatar
    Francisco Reply

    Hi Timo,

    Awesome post! Thanks for putting this together 🙂

    I have mySQL and WebServer installed remotely on a VM. Everything is set up. I modified the trex file by replacing ‘localhost’ with my VM’s IP address but I’m getting the following error when adding the extension:

    Unable to complete action
    Error parsing extension manifest :
    Error(10,66): value ‘http://192.168.0.18:8888/myExtensions/index.html’ does not match regular expression facet ‘[Hh][Tt][Tt][Pp][Ss]://.+|[Hh][Tt][Tt][Pp]://[Ll][Oo][Cc][Aa][Ll][Hh][Oo][Ss][Tt]|[Hh][Tt][Tt][Pp]://[Ll][Oo][Cc][Aa][Ll][Hh][Oo][Ss][Tt][:/].*’ (id: )

    I’m not sure how to solve this issue. Could you help me?

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hey Francisco,
      Did the connection with the local My SQL work? Please ensure this first.

      Secondly try to ping the VM from the machine you‘re running the app on and make sure firewalls aren’t blocking you.

      Last but not least please ensure you‘re having the same database encoding I setup for this app.

      Please keep the community updated,
      Timo

    • Avatar
      Matt Fette Reply

      Hi Francisco:

      We are having the same issue. Were you able to resolve your issue? If so, what was the cause.

      Thanks, Matt

  6. Avatar
    Matt Fette Reply

    Hi Timo:

    Very nice. Would you be able to modify it to use a SQL Server database rather than a MySQL database?

    Thanks, Matt

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hi Matt,
      yes, absolutely! Simply navigate to the following folder C:/xampp/htdocs/Tableaufans-Commenting-Extension/php and find the ~writeBack.php file. If you‘ve installed the drivers for other databases simply change the connection here.

      You might need to install additional PHP libraries to establish the connection.

      Please let me know if this worked for you.

      Cheers,
      Timo

      • Avatar
        Matt Fette Reply

        Hi Timo:

        I altered your MySQL script to create the tables in a DB called yoursqldb in MS SQL Server. However, in the Tableaufans-WriteBack-2018.2 workbook, your data sources don’t match with the tables created by the script or the tables shown in your documentation.
        Workbook Data Sources:
        DatasourceMySQL
        SuperstoreEurope (Only)
        writeBackTableOnly

        Tables created by provided/attached MySQL script:
        getdataandwriteback
        superstoreeurope

        Is there an update to the documentation or am I missing something?

        Thanks, Matt

  7. Avatar
    Matt Fette Reply

    Hi Timo:

    We have the figured out our issue with the data sources and that’s okay now. However, like Francisco above, we are in a VM environment and the database server is separate from the Tableau server:

    Unable to complete action
    Error parsing extension manifest :
    Error(10,128): value ‘http://1qvbidb01.ourcompany.com:8888/extensions-api-master/myExtensions/Tableaufans-WriteBack-2018.2/index.html’ does not match regular expression facet ‘[Hh][Tt][Tt][Pp][Ss]://.+|[Hh][Tt][Tt][Pp]://[Ll][Oo][Cc][Aa][Ll][Hh][Oo][Ss][Tt]|[Hh][Tt][Tt][Pp]://[Ll][Oo][Cc][Aa][Ll][Hh][Oo][Ss][Tt][:/].*’ (id: )

    Any ideas?

    Thanks, Matt

    • Avatar
      Matt Fette Reply

      Hi Timo:

      We are able to add the extension without issue when using localhost in the .trex file. However, if we try to use the actual server name: 1qvbidb01, it keeps returning the same parsing error, both local on the 1qvbidb01 DB server and remote from the actual Tableau server. Is localhost hard wired in whatever is processing the .trex file? We would really love to be able to run this from our Tableau server.

      Thanks, Matt

      • Timo Tautenhahn
        Timo Tautenhahn Reply

        Hi Matt,
        I‘ve overseen that you‘re using http. All extensions must use HTTPS. Localhost is the only exception as it allows you to quickly test extensions locally.

        Maybe that’s causing the error. So please get your server a certificate so that it’s HTTPS ready.

        Thanks,
        Timo

        • Avatar
          Matt Fette Reply

          Hey Timo:

          That did the trick. We applied a public wildcard SSL certificate to the domain and changed the URL in the .trex file to https. We were then able to get it to work, but we were having mixed content issues where it was only showing secured content. We also had to modify the URLs for the two CDN subdomain URL’s (datatables.css and datatables.js) to use https rather than http in the index.html file. Once we did that, everything worked.

          We really appreciate all your help. Now it’s time to try and convert to SQL Server from MySQL, and potentially IIS from Apache.

          Thanks, Matt

          • Timo Tautenhahn
            Timo Tautenhahn

            Awesome! Glad to read this!

            Please keep us updated. Maybe you want to feed your modifications back to the great Tableau community. I‘m happy to let you create a „guest post“ so that Tableau fans globally can leverage your great work around MSSQL and IIS!

            Thx,
            Timo

  8. Avatar
    Matt Fette Reply

    Will do.

  9. Pingback: tableaufans.com » Tableau Extension:  Writeback for SQL Server using Tableaufans.com’s MySQL Writeback as a Baseline

  10. Timo Tautenhahn
    Timo Tautenhahn Reply

    Hi Matt,
    Hi Tableau Fans,
    the one and only David Spezia just joined us on Tableaufans.com. In his first post he created a step-by-step guide on how to replace MySQL with Microsoft SQL Server for this Tableau Extension:

    https://tableaufans.com/extension-api/tableau-extension-writeback-for-sql-server-using-tableaufans-coms-mysql-writeback-as-a-baseline/

    Please let us know if this works fine for you.
    Thanks a lot,
    Timo

  11. Avatar
    Matt Reply

    Hi Timo:

    I’m glad I checked the blog before starting on this. Sorry for taking so long getting back to it. Thanks David! We did pretty much what David did, but replaced Apache with IIS and installed a security certificate so we could move beyond the developer’s localhost environment:
    * Tableau requires that you have a certificate/https if you are using anything other than localhost.
    * Install the certificate.
    * Update the manifest/trex file with the https URL.
    * You will need to install the latest SQL Server-PHP drivers. You can use the Web Platform Installer in IIS to search for and install the latest drivers.
    * On the Tableau Server, log on as an administrator. Click on the ‘Settings’ link, then on the Extensions link. You can now update Tableau Server with the https URL for the extension. Set the Full Data Access dropdown to Allow and the User Prompts dropdown to Hide.

    Matt

  12. Pingback: tableaufans.com » How to write back data to SAP HANA?

  13. Pingback: tableaufans.com » How to write back data to Microsoft SQL Server, MySQL or SAP HANA?

  14. Avatar
    santhosh Reply

    Hi Matt,
    Im facing the same issue here. I need to write back something into MYSQL DB which is in other machine and not in the Tableau server machine.
    What are the steps has to be done? Can you elaborate. It would be more helpful. Thanks in advance.

  15. Avatar
    santhosh Reply

    Hi Timo,
    Until step 5, I have done. Please help here to make sure how to start the services.

    Thanks

  16. Avatar
    Santhosh Reply

    Have received the below error,

    1:24:43 PM [main] XAMPP Version: 7.0.23
    1:24:43 PM [main] Control Panel Version: 3.2.2 [ Compiled: Nov 12th 2015 ]
    1:24:43 PM [main] You are not running with administrator rights! This will work for
    1:24:43 PM [main] most application stuff but whenever you do something with services
    1:24:43 PM [main] there will be a security dialogue or things will break! So think
    1:24:43 PM [main] about running this application with administrator rights!
    1:24:43 PM [main] XAMPP Installation Directory: “c:\xampp\”
    1:24:43 PM [main] Checking for prerequisites
    1:24:43 PM [main] All prerequisites found
    1:24:43 PM [main] Initializing Modules
    1:24:43 PM [Apache] Problem detected!
    1:24:43 PM [Apache] Port 80 in use by “Unable to open process” with PID 8640!
    1:24:43 PM [Apache] Apache WILL NOT start without the configured ports free!
    1:24:43 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
    1:24:43 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
    1:24:43 PM [Apache] Problem detected!
    1:24:43 PM [Apache] Port 443 in use by “Unable to open process” with PID 8640!
    1:24:43 PM [Apache] Apache WILL NOT start without the configured ports free!
    1:24:43 PM [Apache] You need to uninstall/disable/reconfigure the blocking application
    1:24:43 PM [Apache] or reconfigure Apache and the Control Panel to listen on a different port
    1:24:43 PM [mysql] Problem detected!
    1:24:43 PM [mysql] Port 3306 in use by “Unable to open process”!
    1:24:43 PM [mysql] MySQL WILL NOT start without the configured ports free!
    1:24:43 PM [mysql] You need to uninstall/disable/reconfigure the blocking application
    1:24:43 PM [mysql] or reconfigure MySQL and the Control Panel to listen on a different port
    1:24:43 PM [main] Starting Check-Timer
    1:24:43 PM [main] Control Panel Ready

    Hope due to port, the services are not getting started.

  17. Timo Tautenhahn
    Timo Tautenhahn Reply

    Hey Santosh,
    please to the following:

    1. Did you download the XAMPP I’ve been providing you with within my blogpost? There shouldn’t be any service running on 80. I’ve pre-configured my XAMPP to use port 8888.

    2. In order to run XAMPP you NEED to have ADMIN RIGHTS on your machine. Can you right click on the *.exe and say “Run as administrator”?

    3. Once you’ve made sure you’re running XAMPP as administrator you COULD manually change the ports, BUT changing the ports WILL REQUIRE CHANGES within the SOURCE CODE! Therefore this is not recommended unless you know where to adjust it within the code!

    –> If you still can’t run XAMPP because of the use of port 8888 and 3306 you might already have a web server and MySQL in place. In this case you could simply copy the content of “htdocs” into your existing web server as well as moving the table(s) from the MySQL database within my XAMPP into your existing MySQL database. My advice is to get this Extension up and running on a blank machine (Virtual Machine) first. Once this is working you can move piece by piece into your own environment which is way easier than modifying pieces from within the tutorial before it fully works.

  18. Avatar
    Caleb Thompson Reply

    Hi there,
    I followed all of the steps. However, when I place the extension into the dashboard, it looks like this: https://ibb.co/6WfcD5h

    Have you ran into this issue before?

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hi Caleb,
      Yes, it happened to me when I was not having an internet connection. The Extension leverages libraries which are publicly available and therefore recquire having an internet connection.

      • Avatar
        Caleb Thompson Reply

        Thank you for replying. I looked into the Tableau log file and there is an error: “WebPage javaScriptConsoleMessage: message=Uncaught ReferenceError: $ is not defined sourceId=http://localhost:8888/extensions-api-master/myExtensions/Tableaufans-WriteBack-2018.2/MarksSelection.js lineNumber=6”

        Line 6 is: $(document).ready(function () {

        I can view the index file properly (formatted correctly) in Chrome, but within Tableau it looks like this https://ibb.co/6WfcD5h

        • Avatar
          Caleb Thompson Reply

          The way to solve this is to download all of the datatable libraries locally and reference the file path instead of the URL. This seemed to do the trick.

  19. Avatar
    Ryan Reply

    Timo – got everything working, but the workbook is not writing back on the download icon in your extension. Doubled checked the troubleshooting tips and all is good there.

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hey Ryan,
      what do you see within Chromium once you’re pressing the “Write Back” button? (Once you opened Tableau in debug mode you should see something like this https://youtu.be/1qswvPhd8Yk?t=127)

  20. Avatar
    Jackie Reply

    Any chance this I could modify this to work with Postgres?

  21. Avatar
    Quang Reply

    Hi Timo,

    Could you make a follow up video on explaining the functionality of the buttons? For some reason i can only writeback for each person values, but i cannot do anything else. Clicking on the crank and selecting different button does nothing, when i swap then through sheets it does, but writes also again nothing. Would be really great if we could also rewrite another stuff like the whole pipeline.

    Btw: is there any chance a feature that can delete or showing a list of all values ever edited be implemented?

    Thanks alot Timo for this demo. If there would be any chance I could get back at you or you at me through emails or any possible communication tools, would be great!

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hi Quang,
      if you’d like to see the other buttons in action simply download Tableau’s Extension tutorial. This shows you all the other buttons in action. For this Extension I’ve just been focussing on writing back data to a database. So all the other buttons are free so that you can put your own functionalities on top of them.

      According to your deletion/edited feature -> Yes, this can absolutely be implemented! Extensions are basically web containers where you can put any logic behind which is supported by common web technologies.

      Please feel free to connect via LinkedIn 😉

  22. Avatar
    naziya Reply

    Hello Timo,

    Thanks for the detailed tutorial on write back extension.
    I followed the steps and tried to write back, but it doesn’t for some reason.
    On chromium I have debugged, below is the error shown.

    Uncaught (in promise) This extension is not running inside an iframe, desktop, or popup window. Initialization failed.

    Please suggest.

  23. Timo Tautenhahn
    Timo Tautenhahn Reply

    Hey naziya,
    with just with this single line it’s hard to tell why it’s not working. I’ve been lately releasing a version which doesn’t require you to setup the whole database anymore. So what do you think about jumpstart your writeback test with this asset?

    https://tableaufans.com/tableau-server/tableau-demo-site/

    Cheers,
    Timo

  24. Avatar
    Naziya Reply

    Hello Timo,

    Thanks for the quick turnaround 🙂

    Let me elaborate the two scenarios I am facing :
    1. When I add the extension to the tableau dashboard and run the XAMPP Apache server, the following error is shown .
    ——————————————————————
    Object not found!

    The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

    If you think this is a server error, please contact the webmaster.

    ——————————————————————-
    2. As Node.js was configured in my environment , I just thought of testing using that and I added the localhost:8765 in Tableaufans-WriteBack-2018.2.trex file. When I run the npm start, I am able to see the write back extension, but when I click on “Pipeline” as sheet to choose data selection, “POST /Tableaufans-WriteBack-2018.2/php/writeToDb.php” Error (404): “Not found”is the error prompted in the command prompt.

    My question is regarding the difference in behavior of File not being found for xampp but it being rendered using another server.We can probably look at understanding this issue and I guess, if we are able to resolve it , it should also help in understanding the writeback error.
    With Best Regards
    Naziya

  25. Avatar
    Naziya Reply

    Hello Timo,

    I have placed the extension folder in htdocs and I am able to see the write back extension, but not able to write back when selecting any customer and adding the sum value.

    Thanks,
    Naziya

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hi Naziya,
      the fastest way to get it up and running from now on is the following Quickstart Guide!

  26. Avatar
    Omar Reply

    Hello Timo,

    Thanks for the writeup on this, very informative and useful. Are there risks of adversely affecting my MS SQL or Teradata database were I to try this writeback extension and set it up incorrectly?

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hi Omar,
      you’re welcome and please feel free to adjust it to your own needs!!! You can absolutely adjust the Extensions to write data back to your backend of choice! For MSSQL you can have a look at the steps necessary in this post “Write back to MSSQL Server

  27. Avatar
    Michael Seifert Reply

    Hi Timo,

    thanks for that interesting feature. I’ve got some business folks around that got pretty excited in leveraging that extension for their needs.

    As i don’t want to have yet another SQL Server floating around and do have some severe constraint in license compliance and IT security to write back to my original database can your extension be adapted to consume an ODATA service instead of plain SQL?

    Best regards
    Michael

    • Timo Tautenhahn
      Timo Tautenhahn Reply

      Hi Michael,
      sounds great! As of today Tableau supports extract only connections for OData. Therefore you probably don’t want to go down this path for write back scenarios, but if you already have SQL Servers floating around, why not leverage them?

      According to writing back to the original database table. You can absolutely do this, but you might want to keep the history of all comments about a single data point like in this demo video at 5:45min here. Therefore blending or joining a history table works like a charm.

      Cheers,
      Timo

      • Avatar
        Michael Seifert Reply

        Hi Timo,

        Thanks for the hint.
        why not leverage them? Because I want to get rid of them! Why?: Governance, Compliance, Data Security/Protection/Privacy, Performance, Maintenance, … and myriads of other reasons.

        I need the ODATA just for the write back. Read can be SQL/ODBC again. SAP is quite strict with the licenses and writing natively into HANA is not allowed in our case. And ODATA is the way how SAP enables write back for FIORI. Hence I was thinking leveraging that way.

        Cheers Michael

        • Timo Tautenhahn
          Timo Tautenhahn Reply

          Hi Michael,
          thx for clarifying! So writing data back via OData is absolutely fine! I thought you’d mean reading the updated data with an “Extract only Connection”. You can do this, but you probably prefer live connections for write back scenarios.

          I just have no experience with writing data back via OData. If this can be done via PHP just search for “C:\xampp\htdocs\extensions-api-master\myExtensions\Tableaufans-Commenting-Extension\php\writeToDb.php” where you could adjust the write back code to your needs.

          Cheers,
          Timo

          • Avatar
            Michael Seifert

            Hi Timo,

            thanks for your reply. I’m currently trying to find a PHP developer inhouse to adjust the script accordingly. Will let you know once we succeeded.

            BR Michael

Leave a Reply to Adrien Cancel reply

*

captcha *