Jump to content

Displaying label values based on Document Property dropdown values in spotfire


SREEJAYAN cheri

Recommended Posts

Hi,

I have a requirement to show values based on a drop down list:

Dropdown: Currency (CAD, USD) -> (Document.Property("CurrencyProperty")

I have a labeldefined in the text area:

Current Authorization:

I have captured the 2 column values from the data table, in 2 different document properties:

Document.Properties("CurrentAuthUS"), Document.Properties("CurrentAuthCAD")

Is there anything that I can do in ironPython, so that when the user selects the drop down value, I can display the appropriate value:

something like: if (${CurrencyProperty}='CAD', $Document.Properties("CurrentAuthCAD"),Document.Properties("CurrentAuthUS"))

I believe a simple if statement should do it, but have been struggling to get it ... any help appreciated.

Thanks

Link to comment
Share on other sites

If I understood correctly what you're trying to achieve, I believe in the IronPython script you can simply do:

if Document.Properties["CurrencyProperty"] == "CAD":

Document.Properties["CurrentAuth"] = Document.Properties["CurrentAuthCAD"]

elif Document.Properties["CurrencyProperty"] == "USD":

Document.Properties["CurrenAuth"] = Document.Properties["CurrentAuthUSD"]

else:

raise Error("Unkown CurrencyProperty: `" + str(Document.Properties["CurrencyProperty"] + "`.")Another more fancy way would be:

 

Document.Properties["CurrentAuth"] = Document.Properties["CurrentAuth" + str(Document.Properties["CurrencyProperty"])]

Link to comment
Share on other sites

  • 4 weeks 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...