title: Tableau API JavaScript Filter Example
body: <p>I am trying my had at the <a href="http://onlinehelp.tableausoftware.com/samples/en-us/js_api/tutorial.htm" rel="nofollow">JavaScript API Tutorial</a> that tableau provides. When I got to the filter portion I got a little lost and was hoping for some guidance. I have created a fiddle and trimmed down the code to the bare minimum:</p>
  
  <pre><code>var placeholderDiv = document.getElementById("tableauViz");
  var url = "http://public.tableausoftware.com/views/WorldIndicators/GDPpercapita";
  var options = {
    hideTabs: true,
    hideToolbar: true,
    width: "800px",
    height: "400px",
    onFirstInteractive: function () {
      workbook = viz.getWorkbook();
      activeSheet = workbook.getActiveSheet();
    }
  
  };
  viz = new tableauSoftware.Viz(placeholderDiv, url, options);
  
  function filterSingleValue() {
    activeSheet.applyFilterAsync(
      "Region",
      "The Americas",
      tableauSoftware.FilterUpdateType.REPLACE);
  } 
  </code></pre>
  
  <p>When I run the consol debugger, I get the following error:</p>
  
  <pre><code>"Uncaught ReferenceError: filterSingleValue is not defined " 
  </code></pre>
  
  <p>I am not sure what that means, but I am guessing that the filterSingleValue() function isn't actually passing any data. Is it because I don't have the first part wrapped in a function?</p>
  
  <p>My goal is to just have my filter button filter on "The Americas" region. Appreciate any guidance or suggestions. Here is my <a href="http://jsfiddle.net/6wjv502o/" rel="nofollow">fiddle</a></p>