sisense.com

Dashboard Filters Object

Available via dashboard.filters. Represents the Dashboard's filters, and provides methods to access & modify them.

Properties

NameTypeDescription
lengthintegerHow many filters exist in the dashboard
$$itemsMetadataItem[]A read-only array of existing filters

Methods

item

Fetch a filter from the Dashboard by index or dimension

Get filter by index

filters.item(index)

Arguments

NameTypeRequiredDescription
indexintegerYesIndex of filter to fetch

Returns

MetadataItem

Example

console.log(dashboard.filters.item(0));

Get filter by dimension

filters.item(dimension[, level])

Arguments

NameTypeRequiredDescription
dimensionstringYesDimension name to fetch filter for
levelstringNoDimension level - only applicable to date filters

Returns

MetadataItem

Example

console.log(dashboard.filters.item('[Sales.SaleDate (Calendar)]', 'years'));

update

filters.update(filter, options)

Adds or updates the filter object matching the dimensions and level of the given filter.

If the provided filter's dimension already exists in the Dashboard, it will be updated. Otherwise, a new filter will be appended to the end of the Dashboard's filters array.

Arguments

NameTypeRequiredDescription
filterMetadataItemYesFilter object to add or update
optionsobjectYesSee below
options.refreshbooleanYesShould the Dashboard refresh after the change
options.savebooleanYesShould the change be saved to the server

Returns

N/A

Example

// Add a new filter temporarily (without saving)
dashboard.filters.update(newFilter, { refresh: true, save: false });

remove

Remove a filter from the Dashboard by index or dimension.

Cascading filters

Note that the .remove() method cannot be used to remove cascading/dependent filters.

Remove filter by index

filters.remove(index)

Arguments

NameTypeRequiredDescription
indexintegerYesIndex of filter to remove

Returns

MetadataItem

Example

dashboard.filters.remove(0);

Remove filter by dimension

filters.remove(dimension[, level])

Arguments

NameTypeRequiredDescription
dimensionstringYesDimension name to remove filter by
levelstringNoDimension level - only applicable to date filters

Returns

MetadataItem

Example

dashboard.filters.remove('[Sales.SaleDate (Calendar)]', 'years');

clear

filters.clear()

Removes all items from the filters collection.

Arguments

N/A

Returns

N/A

Example

dashboard.filters.clear();

insert

filters.insert(filter[, index])

Inserts a new filter to the Dashboard's filters array at the provided index, similar to a splice operation.

If index is undefined, the filter will be appended to the end of the array.

Arguments

NameTypeRequiredDescription
filterMetadataItemYesFilter object to add
indexintegerNoIndex to insert to

Returns

N/A

Example

dashboard.filters.insert(newFilter, 2);

reorderItem

filters.reorderItem(sourceIndex, targetIndex)

Moves a filter item from the sourceIndex to the tagetIndex position in the Dashboard filters array.

Arguments

NameTypeRequiredDescription
sourceIndexintegerYesIndex to move item from
targetIndexintegerYesIndex to move item to

Returns

N/A

Example

dashboard.filters.reorderItem(2, 4);
Last Updated: