3 Replies Latest reply on Oct 7, 2018 11:45 AM by Man Tsui

    Tableau Integration with HTML and JS

    Avancs avancs

      Hi,

      I am working on integrating Role based access with Tableau and was able to get the same implemented with user groups etc.

      Extending further my req, i am looking for any suggestions on how i can implement the same using html and JS.

       

      Ex: When User login, based on his role he will be shown only 3 reports and for User B he should be able to see 3 from User A + 2 more and Super User can see all the reports which both A and B can see.

      By Using GetData function i am able to get the report names however i want to map them to a drop down usign java script so that i can display the reports as a menu and users can click and navigate to the respective report.

       

      apologies in case if i am not clear!!

       

      Thanks in advance!!

        • 1. Re: Tableau Integration with HTML and JS
          Man Tsui

          Hi Avanc,

           

          As much as I'm a big fan of Tableau Javascript API.

           

          This sounds more like a row-level security user issue in Tableau as opposed to Javascript API.

          *Just to double check

          First, have you tried standard Tableau user filter solution. (It typically does not involve Javascript API).

          https://www.youtube.com/watch?v=1dAEDpuFw2c

          https://tableauandbehold.com/2016/08/08/defusing-row-level-security-in-tableau-data-extracts-before-they-blow-up-part-1

           

          If you've tried the Tableau user filter (row level security) technique and need more advanced customization. That would probably be involved in Tableau REST API as opposed to Javascript API.

          https://www.tableau.com/learn/tutorials/on-demand/rest-api?product=tableau_server&version=9_3&topic=apis&signin=3d345e73ec1cd0bca9e6a0aa76fe5d9d

           

          Tableau actually has a suite of API: Javascript API, Rest API, Document API, Extension API to name a few. There was a very nice summary slide of the API suite but I can't seem to find it.

          • 2. Re: Tableau Integration with HTML and JS
            Avancs avancs

            Thank You Very Much for your time and response Man Tsui.

            Sorry in case of i am not clear with my question,

             

            The Reason for me to use the JavaScript or REST API is as below

             

            1. I have a web Page with in which i am displaying the visualization in a Iframe.

            2, On top of the Web Page, I have a Menu where the Menu Items will be the list of Report Names from Tableau Server. (As of now i have about 100 Reports that may eventually grouped further)

            3. Based on the Roles of the logged in Users all the reports may not be shown under the Menu.

                 Ex: User A will have only 10 and B may have 15 and C may have all of them displayed and he should be able to select any report that he would like to see

            4. Using the example here https://bl.ocks.org/darshit-shah/0cda3feb94cf55ddcb70e0117b1b127c

                 I got all the reports names that user is entitled to see ( i have implemented Groups and Row Level Security)

            5. The column from Step which the Report Name, i want to divert and display it as links under Menu from which user can click and nabigate

            6.Precisely Step # 5 is what i am looking for...

             

            Hope i am clear now and thanks again for your reply

            • 3. Re: Tableau Integration with HTML and JS
              Man Tsui

              Hi Avancs,

               

              Thank you for the added clarification.

              Perhaps this is one strategy you can try (I have not implemented on this before):

               

              Step 1: Create a hidden sheet with calculated field for USERNAME() and/or USERDOMAIN()

              Step 2: Add and hide this sheet into your dashboard. This will still allow for getData() at the javascript level.

              Step 3: Dynamically assign report items at the javascript level.

              Tableau Get Username.png

               

              Important caveat/trade-off

              - Make sure you double check this with your organization's IT security and database administrator. You need to get your organization's IT security blessing on this.

               

              - Javascript/webpage optimization, depending on how long your user list/report items, it may affect webpage processing.

               

              Disclaimer: I'm not a database administrator, I'm actually an accountant.