2 Replies Latest reply on Mar 3, 2017 4:18 AM by Maciek La

    Date slider with API

    Maciek La

      Hi All!

      I am making my first steps in Tableau API and got stuck on one of the issues.

      I am having a dashboard with broad time range and would like to make sure that initial view is loaded only for the last 30 days. I manage to do this by using (currently hardcoded date but it's not a problem)

       

           function showRange2(filter,minVal,maxVal)      
       {           
      sheet=viz.getWorkbook().getActiveSheet();
                 if(sheet.getSheetType() ==='worksheet')
                 {
                       sheet.applyRangeFilterAsync (filter,
                      {
                      min: new Date(Date.UTC(2016, 11, 1)), // new Date(minVal)
                      max: new Date(Date.UTC(2016, 11, 1)) // new Date(maxVal)
                       })
                      } else {
                       worksheetArray = sheet.getWorksheets();
                      for (var i =0;i<worksheetArray.length;i++){
                            worksheetArray[i].applyRangeFilterAsync     (filter,
                           {
                            min: new Date(Date.UTC(2016, 11, 1)),
                           max: new Date(Date.UTC(2016, 11, 1)) // new Date(maxVal)
                             })
                            }
                  }
              }

       

       

      However, upon running the script my date filter slider shows only this range without any option to show the full scale. I would like user to be able to extend the timerange if broaded analysis is needed. Is there any way to do this?

       

      br,

      m.