Use APIs on Story Filter and Variables

As a story developer, you can use script APIs related to story filters and variables to let story viewers change the visibility of the filter panel, set story filters and set story variables, for example.

Use APIs Related to Filter Panel

You can use the following APIs to let viewers show or hide the filter panel and check its visibility respectively:

Use APIs Related to Story Filters

You can use script APIs related to story filters, which are applied to all widgets with the same data source across pages. The APIs also work for linked analysis applied to All Widgets in the Story.

You can use the following script APIs to set, remove and get the story filters respectively:
For the setDimensionFilterWithHierarchy API:
  • The hierarchy parameter is mandatory. If there's no hierarchy in the dimensions, use Alias.FlatHierarchy for the parameter.

  • Dimension and fixed date range filters are supported, while widget-level measure and dynamic date filter aren't supported.

  • TimeRange isn't supported for user-managed date dimensions.

For the getDimensionFilters restrictions, refer to Known Restrictions section in Use getDimensionFilters API.

In addition, via the APIs you can let viewers create custom current date (CCD) input controls based on either calendar or fiscal time:
Here're the parameters for calendar time:
enum CalendarTimeGranularity {
   Year,
   HalfYear,
   Quarter,
   Month,
   Week,
   Day
}
class CalendarTime {
    granularity:  CalendarTimeGranularity,
    year: integer,                      // >= 0, for example, 2013     
    halfYear?: integer,                 // for example, 1..2
    quarter?: integer,                  // for example, 1..4
    month?: integer,                    // for example, 1..12
    week?: integer,                     // for example, 1..53
    day?: integer,                      // for example, 1..31 (day need to work together with month and year)
}
Here're the parameters for fiscal time:
enum FiscalTimeGranularity {
   FiscalYear,
   FiscalQuarter,
   Period,
   FiscalDay
}
 
class FiscalTime {
    granularity:  FiscalTimeGranularity,
    fiscalYear:integer,      // >= 0, for example, 2013
    fiscalQuarter?: integer, // for example, 1..4
    period?: integer,       // for example, 1..12
    fiscalDay?: integer,   // for example, 1..31 (fiscalDay need to work together with period and fiscalYear)
}

Use APIs Related to Story Variables

You can use the following script APIs to set, remove and get the story variables respectively: