ironpython - Spotfire IronPython 循环遍历属性

标签 ironpython spotfire

如何使用 Ironpython 返回 Spotfire 文件中文档属性的完整列表。

属性可以通过

设置
Document.Properties["myProperty"] = "myValue"

我想做这样的事情

for myProperty in Document.Properties:
     print myProperty
     #Some checks like if myProperty.Name = 'name1' then ...

找到了这个,但还不能让它工作(它返回的不仅仅是属性:http://www.cambridgesoft.com/support/EnterpriseSupport/KnowledgeBase/FAQ/details/Default.aspx?TechNote=2344

from Spotfire.Dxp.Data import *

for DocProp in Document.Data.Properties.GetProperties(DataPropertyClass.Document):
    print DocProp.Name, DocProp.Value

最佳答案

DocumentProperty 对象的一个​​名为 isUserVisible 的属性可以在此处为您提供帮助。

从技术上讲,列表中出现的所有内容都是文档属性(例如,它们是“文档的属性”),并且可以通过编辑»文档属性 访问它们。要获得您期望的 DocumentProperties(如“在此文档中创建的变量”),您可以运行如下命令:

from Spotfire.Dxp.Data import DataPropertyClass

for d in Document.Data.Properties.GetProperties(DataPropertyClass.Document):
    if d.IsUserVisible: print d.Name, d.Value

你只需要DataPropertyClass用于枚举;没有进口也可以达到同样的效果:

for d in Document.Data.Properties.GetProperties(0):
    if d.IsUserVisible: print d.Name, d.Value

(请注意,您仍会获得默认情况下随每个文档创建的 MaxMissingTimePartsFiscalYearOffset 属性。)

关于ironpython - Spotfire IronPython 循环遍历属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32433502/

相关文章:

python - IronPython:无法识别双关键字?

ironpython - Spotfire 中的金字塔创建

count - Spotfire:使用 IronPython 计算标记行的数量,无需迭代

c# - 在 C# Web 应用程序中嵌入 IronPython 2 的问题

.net - ping/通知 .NET Windows 服务的最简单方法是什么?

ironpython - 用于 Spotfire 中列表框过滤器的 Iron Python 脚本

c# - 在 IronPython 中使用 C# 代码

python - 在 Spotfire 中加载数据表后执行 IronPython 脚本

Spotfire 插件缓存设置,可视化未在 Web 界面中正确加载。有什么建议吗?