Maddy Keyan Posted October 31, 2019 Share Posted October 31, 2019 Hi, Trying to get latest date selected in Listbox filter for date column in text area, below is the script i have tried it is not allowing to select latest date perhaps selects all the values. If anyone can correct/guide me would truly appreciate it. from System.Reflection import Assembly from Spotfire.Dxp.Data.Collections import from System.Runtime.Serialization import ISerializable from System.Collections import IComparer from System.Collections.Generic import IComparer import Spotfire.Dxp.Application.Filters as filters import Spotfire.Dxp.Application.Filters.ListBoxFilter from Spotfire.Dxp.Application.Filters import FilterTypeIdentifiers column = Document.Data.Tables['DATA_TABLE'].Columns['COLUMN_NAME'] values = column.RowValues.GetEnumerator() #Val is a value inside the Column specified in the GetFilter #print values myValues = [] for Val in values: if Val.HasValidValue: #exclude empty values myValues.Add(Val.ValidValue) print Val.ValidValue myValues.sort(reverse=True) column.Properties.SetCustomSortOrder(myValues) myPanel = Document.ActivePageReference.FilterPanel myFilter= myPanel.TableGroups[0].GetFilter("DATE_COLUMN") #ListBoxFilter myFilter.FilterReference.TypeId = FilterTypeIdentifiers.ListBoxFilter listBoxFilter = myFilter.FilterReference.As[filters.ListBoxFilter]() listBoxFilter.IncludeAllValues=False listBoxFilter.SetSelection(myValues) #uncheck all #ListBoxFilter.IncludeEmpty = False #make sure to clear the empty values #for value in ListBoxFilter.Values: # ListBoxFilter.Uncheck(value) #ListBoxFilter.Check(myValues) Thanks Maddy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now