Filter
The filter objects contain information on how to dynamically filter embedded content (both Discover reports and Present dashboards).
Constructors
create(): filter
or
by(dimension: string, hierarchy: string, member: string): filter
or
byUniqueName(mnember's uniquename :string): filter
- Use this to create an instance of the filter object,
- Filters are attached to embedded content via the EmbedOption object.
- The constructor cannot be called until the library has been loaded.
- the 3 constructors allow developers to instantiate a filter:
- "create" builds a blank filter
- "by" creates a new filter and adds a new member for filtering using the 3 part naming convention
- "byUniqueName" creates a new filter and adds a new member for filtering using the unique name convention
Once instantiated, use the methods below to create and manipulate filters.
Methods
- add- manually adds one or more filters to the initial filter object, using the 3 part naming convention
- addUniqeName - manually adds one or more filters to the initial filter object, sing the unique name convention
Example
The following instantiates a new filter object and attaches a filter for the year 2020 from the dates dimension. This is then attached to the embed method using the EmbedOptions object.
var fil = Filter.create(); fil.add("dates","years","2020"); client.embed($("myContainer"), {contentId:"c20d42b4-be24-47cf-b711-d5782f048590", filters: fil})
Alternatively, the filter can be created accordingly:
var fil = Filter.by("dates","years","2020");
Or:
var fil = Filter.byUniqueName("[dates].[years].[2020]");