title: Create new array by matching values passed in url using JavaScript
body: <p>I am building a web application that is primarily using Tableau elements (filters, visualizations, etc.) and the problem I have run into is in passing a large amount (dynamic) of filtered parameters across web pages. I've been trying to work with the JavaScript below, but not having any luck.</p>
  
  <pre><code>function getFilterd()
  {
      var worksheets = vizFilter.getWorkbook().getActiveSheet().getWorksheets();
      var prjArray = window.location.search.substring(1).split(',');
      var newArray = [];
  
      //Run through field/filter names
      var displayFilters = function (filters) {
          for (var i = 0; i &lt; filters.length; i++) {
              filterName = filters[i].getFieldName();
  
              //If field/filter name == PRJECT then store selected values in an array
              if (filterName == 'PRJECT') {
                  filterList = []
                  for (var z = 0; z &lt; filters[i].getAppliedValues().length; z++) {
                      filterList[z] = filters[i].getAppliedValues()[z].value;
                  }
  
                  //Compare filterList values to prjArray and push to newArray if a match
                  for (var t = 0; t &lt; filterList.length; t++) {
                      if (filterList[t].getAppliedValues()[t].value.substring(4) == prjArray) {
                          newArray.push(filterList[t]);
                      }
                  }
              }
          }
      }
  }
  
      //Runs through each worksheet in active workbook (optional) 
      for (var worksheetIndex = 0; worksheetIndex &lt; worksheets.length; worksheetIndex++){ 
      worksheets[worksheetIndex].getFiltersAsync().then(displayFilters); 
      }   
  }
  </code></pre>