Jump to content

Need help-- How to assign selected values from a list box filter to a document property when All is selected using ironpython in spotfire

rahul S

Recommended Posts

from Spotfire.Dxp.Application.Filters import ListBoxFilter




for c in filt.SelectedValues:

print c


This gives me selected values in addition to that I need to print the all values when All is selected in the filter and assign them to a document property.


Link to comment
Share on other sites

So you need to look at the value of IncludeAllValues which will either be True or False. If False, then you can use SelectedValues to get the explicitly selected. If it is True then you need to get all the values (perhaps it can be done through the filter, but i just went straight to the data table here):


from Spotfire.Dxp.Application.Filters import ListBoxFilter

from Spotfire.Dxp.Data import *




# This gets you any explicitly selected values

if not filt.IncludeAllValues:

for c in filt.SelectedValues:

print c


# If (All) is selected then loop through table to get all values


allUniqueValues = ''

cursor1 = DataValueCursor.CreateFormatted(myDataTable.Columns["myColumn"])

for row in myDataTable.GetRows(cursor1):

if allUniqueValues == '':

allUniqueValues = str(cursor1.CurrentValue)

elif allUniqueValues.find(cursor1.CurrentValue) == -1: #if it is not found in the list already, so only unique values are recorded

allUniqueValues += ',' + str(cursor1.CurrentValue)

print allUniqueValuesYou will need to clean up your outputs, but this gives you the general idea.


API Reference:



Link to comment
Share on other sites

  • 1 year later...

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...