Jump to content

Comparison operation using Iron Python script on a multilist document property not working


Michael Zaragoza

Recommended Posts

Newbie question here.

I'm unable to get a comparison operation to work using a multilist document property in an Iron Python script.

The document property has one of two values, "PASS_NUMBER" or "FAIL_NUMBER", which the user can select and with a change in property value the script runs.

The comparison I'm testing is the following:

if Document.Properties["TestSumResult"] == "PASS_NUMBER":

With Document.Properties["TestSumResult"] set to "PASS_NUMBER" the expression effectively returns false eventhough that's not the case. What am I doing wrong

Here's whole script:

from Spotfire.Dxp.Data import DataColumn, TagsColumn

from Spotfire.Dxp.Data import DataPropertyClass, DataType, DataValueCursor, IDataColumn, IndexSet

from Spotfire.Dxp.Data import RowSelection

# Tag the marked rows

markedRowSelection = Document.ActiveMarkingSelectionReference.GetSelection(Document.Data.Tables["MyData"])

table = Document.Data.Tables["MyData"]

myTagColumn = table.Columns.Item["TestSum"].As[TagsColumn]()

if Document.Properties["TestSumResult"] == "PASS_NUMBER":

selectRows = IndexSet(table.RowCount, True)

myTagColumn.Tag("Good", markedRowSelection )

else:

selectRows = IndexSet(table.RowCount, True)

myTagColumn.Tag("NotGood", markedRowSelection )

Link to comment
Share on other sites

MultiList document propert is a List, so you can try to use the following code instead

if Document.Properties["TestSumResult"][0] == "PASS_NUMBER":As there are only two values in the list box and based on your code the user is allowed to select only one value, in this case wouldn't be better to use just a list box instead of multiselect

Link to comment
Share on other sites

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