Jump to content

Recommended Posts

Posted

Hi All,

I am using below script to get the values from a listbox filter:

from Spotfire.Dxp.Application.Filters import ListBoxFilter

#get a reference to a listbox

filt=Document.FilteringSchemes[0][myDataTable][myDataTable.Columns["System Id"]].As[ListBoxFilter]()

#to get the active filtering reference:

#filt = Document.FilteringSchemes[Document.ActiveFilteringSelectionReference][myDataTable][MyDataTable.Columns["symbol"]].As[ListBoxFilter]()

#loop selected values

for value in filt.SelectedValues:

print value

This works fine for single value selection, but doesn't work for multiple selections.

Regards,

Prateek

Posted

Hi Prateek,

 

The answer you want will probably depend on the output you are looking for, I use something similar to pass values to a document property, in order to use it in data limiting in another table. You could use something like the below which would give the following output:

", "","

Used in a data limiting expression you can refer to this as:

[ThingToFilter] in ("${FilterList}")

from Spotfire.Dxp.Application.Filters import ListBoxFilter

from System.Collections.Generic import List

from System import Array

 

 

#get a reference to a listbox

 

filt=Document.FilteringSchemes[0][myDataTable][myDataTable.Columns["System Id"]].As[ListBoxFilter]()

 

 

#Make a new list

FilterList = List [str]();

 

 

#add filter values to list in a loop

for value in filt.SelectedValues:

FilterList.Add(value)

 

 

#convert list to an array

valData = Array [str](set(FilterList))

 

#combine array into a single string with formatting

newList = '", "'.join(valData)

 

#pass string to document property

Document.Properties["FilterList"] = newList

 

Hopefully this suggestion works for you :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...