简体   繁体   English

Spotfire IronPython设置文档属性

[英]Spotfire IronPython set document property

I'm using an IronPython script to reset all filters and also set some document propertries. 我正在使用IronPython脚本重置所有过滤器并设置一些文档属性。 The document property below "FUTUREONLY" is a drop-down property control with 3 possible selections based on expressions. “FUTUREONLY”下面的文档属性是一个下拉属性控件,基于表达式有3种可能的选择。 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. 如果它是一个列表,我已经尝试过... = [“FUTUREONLY”] [1]以及...... [“FUTUREONLY”] =“第二个文字项目在下降线上”以及...... [ “FUTUREONLY”] =用于创建下拉项的表达式。

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': 下面是一个代码片段(它可以工作但是将属性下拉菜单设置为' - '而不是'DROP DOWN STRING'中的'SECOND TEXT ITEM':

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

Thank you, 谢谢,

Chris 克里斯

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. 您的下拉列表设置为“---”的原因是因为列表中不存在“myvalue”。 you must select a valid value that you've specified in the property control options. 您必须选择在属性控件选项中指定的有效值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM