This code resets the filters, marking and document properties to a default setting.
Input variables include:
| Name | Type |
|---|---|
| MyDataTable | Data Table |
| ColumnName | String |
| FilterValue | String |
# Declarations and initial system setup
from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Application.Filters import *
#--------------------------------------------------------------------------------------
# Reset marking
for dataTable in Document.Data.Tables:
# Navigate through each marking in a given data table
for marking in Document.Data.Markings:
# Unmark the selection
rows = RowSelection(IndexSet(dataTable.RowCount, False))
marking.SetSelection(rows, dataTable)
# Reset filters
for filteringScheme in Document.FilteringSchemes:
# Loop through all data tables
for dataTable in Document.Data.Tables:
# Reset all filters
filteringScheme[dataTable].ResetAllFilters()
# Set the default filter
filter=filteringScheme.Item[MyDataTable].Item[MyDataTable.Columns.Item[ColumnName]].As[CheckBoxFilter]()
filter.IncludeEmpty = False
for value in filter.Values:
filter.Uncheck(value)
filter.Check(FilterValue)
#--------------------------------------------------------------------------------------
# Set default document properties
Document.Properties["EquipmentType"]="Mobile" |