Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

We built a Tableau workbook and planning to move them to production soon. As part of the deployment, we need to document all the filters used in the workbook. Is there any way, I can extract all the filters used in a workbook or configurations done in a workbook? Like an API or any other option to get all at once? Because, we have more than 100 sheets and its really difficult to open all, read and document it manually.

Thanks in advance

1 Answer

0 votes
by (47.2k points)
  • Here's the Javascript API to query for all filters in the worksheet. 'Flights' is the sheet name

function getFiltersAsync() {

            // Get first worksheet in book

            var worksheet;

            var filtersVal='';

            var onSuccess = function (filters) {

                $("#lblFiltersCount").text("This worksheet has " + filters.length + " filter(s) associated with it.");

                $.each(filters, function (filter, i) {

                    // use .value property of each DataValue object

                    filtersVal += i.getFieldName() + ", ";

                    $("#lblFilterField").text(filtersVal);

                });

            };

            var onError = function (err) {

                alert("Whoops");

            };

            viz.getWorkbook().activateSheetAsync("Flights").then(function(sheet) {

                worksheet = sheet;

                worksheet.getFiltersAsync().then(onSuccess, onError);

            });

        }

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...