2 Replies Latest reply on Jul 18, 2018 10:35 AM by Dinesh Pilla

    JS API, Context Filters and Incorrect Results

    David Oliver



      Ultimate question: does the JS API work well with Context Filters (http://powertoolsfortableau.com/tableau-performance-series-context-filters))?


      We have a worksheet with a context filter. When using the API (applyFilterAsync and clearFilterAsync) we are not seeing the correct results. The workflow is:


      - Display visualization in a browser, shows 20 locations, the filter is 'Regions'

      - Use  (sheet.applyFilterAsync('Regions', 'South', tableau.FilterUpdateType.REPLACE), vis shows 10 locations in 'South' region

      - Use ((sheet.clearFilterAsync('Regions')), all 20 locations are shown

      - Re-apply filter and only 1 location is shown, when 10 should be


      The context does have a Rank calculation to return the 'top x'.


      It is as if clear is not properly clearing the applied filter. Am I not using apply correctly, should I try 'ADD'?


      Thanks for any insight and advice. Note that I did not setup the context filters and am new to them - hopefully this is not too vague.