\t
Region:
\t
\t
  • Export PDF
  • \t\t\t
  • Export PPT
  • \t
    I wonder if your box is a parameter. In that case you should use: https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/workbook.html#changeparametervalueasync const paramValue = 'City'; // possible values: City, Postal and None (case sensitive) const updatedParam = await viz.workbook.changeParameterValueAsync('Label to display', paramValue); If this post resolves the question, would you be so kind to \"Select as Best\"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.   Regards,   Diego Martinez Tableau Visionary and Forums Ambassador ", "upvoteCount": 1, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D5KX00000kS16M0AS", "datePublished": "2023-10-05T12:40:44.000Z", "author": { "@type": "Person", "name": "DIEGO FERNANDO MARTINEZ RODRIGUEZ", "url": "https://trailblazers.salesforce.com/profileView?u=0054S000001oPU8QAM", "affiliation": { "@type": "Organization", "name": "Modux" } } }, "suggestedAnswer": [] } } Skip to main content

    I successfully filtered Multi select dropdown but when tried to filter the single value dropdown it throws the below error:

    I am not able to filter a single value drop down field and it throws an error.Here is the code:

    function day_filter(day) {

    let viz = document.getElementById("tableauViz");

    let sheet = viz.workbook.activeSheet;

    sheet.applyFilterAsync("Job Created In", ["Last 30 Days"], FilterUpdateType.Replace);

    }

    The is the field I am filtering

    2 answers
    1. Oct 5, 2023, 12:40 PM

      @Tester Techleadz​ 

      Hi, I have tested with a single selection filter and it works:

      <!DOCTYPE html>

      <html lang="en">

      <head>

      <meta charset="UTF-8">

      <meta http-equiv="X-UA-Compatible" content="IE=edge">

      <meta name="viewport" content="width=device-width, initial-scale=1.0">

      <title>Your Embed Project</title>

      <!--- Load Tableau JavaScript API V3 --->

      <script type="module" src="https://public.tableau.com/javascripts/api/tableau.embedding.3.latest.min.js"></script>

      <script type="text/javascript">

      function RegionFilter(region) {

      const viz = document.getElementById('tableauViz');

      var sheet = viz.workbook.activeSheet;

      if (region === "") {

      sheet.applyFilterAsync('Region', [region], 'all');

      } else {

      console.log([region]);

      sheet.applyFilterAsync('Region', [region], 'replace');

      }

      }

      function exportToPDF() {

      const viz = document.getElementById('tableauViz');

      viz.displayDialogAsync("export-pdf");

      }

      function exportToPPT() {

      const viz = document.getElementById('tableauViz');

      viz.displayDialogAsync("export-powerpoint");

      }

      </script>

      </head>

      <body>

      <!--- Viz Component - renders on page load --->

      <div id="controls" style="padding:20px;">

      Region: <select id="changeRegion" onchange="RegionFilter(value);">

      <option value="">All</option>

      <option value="Central">Central</option>

      <option value="East">East</option>

      <option value="South">South</option>

      <option value="West">West</option>

      </select>

      </div>

      <div>

      <li><a style="background-color:#FFFFFF" id="aExportToPDF" href="javascript:exportToPDF();"

      class="cta">Export PDF</a></li>

      <li><a style="background-color:#FFFFFF" id="aExportToPPT" href="javascript:exportToPPT();"

      class="cta">Export PPT</a></li>

      </div>

      <tableau-viz

      id="tableauViz"

      width="1100"

      height="650"

      hide-tabs

      disable-url-actions=false

      src="https://public.tableau.com/views/Test_16355302091630/Hoja1"

      device="Desktop"

      toolbar="bottom"

      >

      </tableau-viz>

      </body>

      </html>

      I wonder if your box is a parameter. In that case you should use:

      https://help.tableau.com/current/api/embedding_api/en-us/reference/interfaces/workbook.html#changeparametervalueasync

      const paramValue = 'City'; // possible values: City, Postal and None (case sensitive)

      const updatedParam = await viz.workbook.changeParameterValueAsync('Label to display', paramValue);

      If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

       

      Regards,

       

      Diego Martinez

      Tableau Visionary and Forums Ambassador

    0/9000