title: Dynamic Parameter in Tableau
body: <p>So I'm under the impression that with JS in html you can do a dynamic parameter in Tableau. Here is my code:</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://public.tableau.com/javascripts/api/tableau-2.0.0.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(function() {
      var url  = 'points to dashboard url';
      var vizOptions = {
          showTabs           : true,
          hideToolbar        : true,
          width              : "420px",
          height             : "420px"
      };
  
      currentViz = new tableauSoftware.Viz(document.getElementById('viz'), url, vizOptions);
   currentViz.addEventListener(tableauSoftware.TableauEventName.FILTER_CHANGE, onFilterChange);
  });
  
  
  function onFilterChange(e)
  {
  if (e.getFieldName() == 'Department') {
      e.getFilterAsync().then(function(filter) {
          var values = filter.getAppliedValues();
          var value = values[0]['value'];
  
          // Value of the parameter if "All" is selected in the filter.
          if (values.length &gt; 1) {
              value = 'All';
          }
  
          currentViz.getWorkbook().changeParameterValueAsync('Parameter1', value);
      });
  }
  }
  </code></pre>
  
  <p></p>
  
  <p>This code I got from <a href="https://www.interworks.com/blog/daustin/2015/12/17/dynamic-parameters-tableau" rel="nofollow noreferrer">https://www.interworks.com/blog/daustin/2015/12/17/dynamic-parameters-tableau</a> and looks pretty plug and play. However, my parameters results are not changing. Note, possible cause for this is that the parameter is actually integer and a list, unlike the tutorial.</p>
  
  <p>Any insight as to the problem?</p>