Spotfire Ironpython-根据选择在下拉列表中选择另一个文档属性的文档属性

发布于 2025-01-30 05:13:19 字数 751 浏览 3 评论 0原文

我正在尝试制作复杂的数据条件,仅在为逻辑设置属性值时,才应应用过滤器。

在下面的屏幕截图中,我试图设置一个条件,如果下拉级的业务为(无),则使用Ironpython脚本将业务过滤器设置为TRUE。

以下铁python脚本:

from System.Collections.Generic import List
from Spotfire.Dxp.Data import *

If Document.Properties["Business"] == NULL:
    Return Document.Properties["BusinessFilter"] = TRUE
ELSE
    Return Document.Properties["BusinessFilter"] = FALSE

但是代码不起作用。非常感谢您的帮助。

I am trying to make a complex data condition where the filter should be applied only if a property value is set for the logic.

enter image description here

In the below screenshot, I am trying to set a condition where if the Business in dropdown is (None), then the Business Filter will be set to TRUE using Ironpython script.

enter image description here

The iron python script is below:

from System.Collections.Generic import List
from Spotfire.Dxp.Data import *

If Document.Properties["Business"] == NULL:
    Return Document.Properties["BusinessFilter"] = TRUE
ELSE
    Return Document.Properties["BusinessFilter"] = FALSE

But the code isnt working. Your help is very much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

记忆之渊 2025-02-06 05:13:19

则在属性“业务”更改值时设置要执行的脚本)

if Document.Properties["Business"] == None:
     Document.Properties["BusinessFilter"] = True
else:
     Document.Properties["BusinessFilter"] = False

有一些语法问题,这对我有用(如果/其他似乎必须是小写的, ;您需要:在其他情况下,您不需要返回;如果您想要布尔属性,则需要采用Python格式(因此不是True)。该代码在没有进口的情况下起作用。

There are a few syntax issues, this worked for me (setting the script to be executed when the property 'Business' changes value)

if Document.Properties["Business"] == None:
     Document.Properties["BusinessFilter"] = True
else:
     Document.Properties["BusinessFilter"] = False

if/else seem to have to be lowercase (you notice they are right when they turn blue in the editor); you need : after else, you don't need Return; and True and False need to be in Python format (so not TRUE but True) if you want a boolean property. The code worked without the imports on top.

冬天旳寂寞 2025-02-06 05:13:19

我能够轻松地使用以下代码获得所需的过滤逻辑。

现在,当选择“业务”过滤器时,我可以使用“业务”过滤器过滤数据,否则请使用所有数据可见。

I was able to obtain the desired filtering logic using the below code easily.

Now I am able to filter data using "Business" filter when selected otherwise go for all data to be visible.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文