Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spotfire IronPython set document property

I'm using an IronPython script to reset all filters and also set some document propertries. The document property below "FUTUREONLY" is a drop-down property control with 3 possible selections based on expressions. When I run the script it reset the document property to '--' and causes all visualizations affected by it to be blank. In case it's a list, I've tried ... = ["FUTUREONLY"][1] as well as ... ["FUTUREONLY"] = "SECOND TEXT ITEM IN DROP DOWN STRING" as well as ... ["FUTUREONLY"] = expression used to create drop down item.

Any idea how to specifically set a drop-down item currently in the drop-down list? Below is a code snippet (it works but sets the property drop-down to '--' instead of 'SECOND TEXT ITEM IN DROP DOWN STRING':

dp = Document.Properties
dp["FUTUREONLY"] = ""

Thank you,

Chris

like image 871
Chris Avatar asked Apr 04 '18 16:04

Chris


People also ask

What is IronPython in Spotfire?

IronPython scripts can access the capabilities available in the Spotfire Analyst API. IronPython scripts can be added to several places in a Spotfire analysis. Scripts can be executed from action controls in the Text Area, from the Graphical Table or the KPI Chart or be triggered by Document Property changes.


1 Answers

you can do this on one line like:

Document.Properties["FUTUREONLY"] = "myvalue"

the reason your dropdown is being set to "---" is because "myvalue" doesn't exist in the list. you must select a valid value that you've specified in the property control options.

like image 127
niko Avatar answered Sep 25 '22 14:09

niko