Set Date RangeFilters porgramatically

from Spotfire.Dxp.Application.Filters import RangeFilter, ValueRange
from Spotfire.Dxp.Data.DataType import  Date

#get a reference to a filter as checkbox from the myDataTable script parameter
filt=Document.FilteringSchemes[0].Item[myDataTable].Item[myDataTable.Columns.Item["Filter Date"]].As[RangeFilter]()

#reset Filter

#set min/max filter dates (same as filt.Reset())
filt.ValueRange = ValueRange(filt.ValueRange.Low,filt.ValueRange.High)

#set filter with custom dates
dt1 = Date.Formatter.Parse("1/15/2014")
dt2 = Date.Formatter.Parse("7/16/2014")
filt.ValueRange = ValueRange(dt1,dt2)

1 comment:

Amit Baweja said...

This is awesome. it really made my day !!