1 Reply Latest reply on Mar 30, 2016 3:21 PM by Jackson Huang

    Getting a list of custom views.

    Nate Erskine

      Hi all,

       

      i was wondering if there was some way i could get a list of the names of all the custom views attached to a specific workbook, then place these names into an array.

       

       

      i tried to use the .getCustomViewsAsync() however it is returning an Object. is there something i need to add to this to pull the names into an array?

        • 1. Re: Getting a list of custom views.
          Jackson Huang

          Hi Nate,

           

          Thank you for your question. The javascript APIs return a Promise object that contains the result. The result is passed as a parameter into the .then() function of the Promise object.

           

          For example you can get the list of custom views in the following way:

           

          function getCustomViewNames(customViews){

               //customViews is an array of CustomView objects, you can iterate through the array and call getName() to get the names of the custom views

          }

           

          workbook.getCustomViewsAsync(

               function(result){

                    getCustomViewNames(result);

               });

           

          You can read more on the behavior the asynchronous API calls here:

          Tableau JavaScript API Concepts--Asynchronous Calls

           

          Hope this answers your question,

           

          Jackson

          1 of 1 people found this helpful