5 Replies Latest reply on Jul 17, 2019 3:12 AM by Akshar Jamgaonkar

    Discrepancy in custom view generation when using JS API to apply filters

    Priti Biyani

                Refer the code snippet for the above tasks:

      const t = window.tableau
      const viz = t.VizManager.getVizs()[0]
      const workbook = viz.getWorkbook()
      const activeSheet = workbook.getActiveSheet();
      const sheets = activeSheet.getWorksheets();
      sheets[0].applyFilterAsync("[Database].[Region]",["Africa", "Americas", "Asia"],"REPLACE" )
        .then((customview) => { console.log("Custom view created", customview.getUrl()) }) // THe url returned has original view instead of custom view. 
        .otherwise((error) => { console.log("Error in updating custom view", error.getUrl()) })
      workbook.showCustomViewAsync("new-custom-view") // This shows the original view instead of with filters applied. 

      • Expected Behavior
        • After saving the custom view with filters applied, we would get view with filters applied.
      • What's actually happening?
        • Instead of getting custom view, when we hit the url, we do get the original sheet view.

      Although the same behavior doesn't happen when we apply filters using built-in pane instead of using API. TableauAnalysisWithTabPane.png

      It seems internally the same API is not being used as the one which is exposed and hence the discrepancy. Is there any workaround for this? Or should we be using some different API to remember the custom view?


      Thanks in advance.