You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用IronPython脚本重新加载TIBCO Spotfire单个数据操作失败求助

解决IronPython脚本重新加载Spotfire单个数据操作失败的问题

我尝试使用IronPython脚本重新加载TIBCO Spotfire中的单个数据操作,但未能成功。从TIBCO社区找到如下解决方案脚本,但无法正常运行:

from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Data.DataOperations import *
from System import *

# Get the first data source from the Source View
op = table.GenerateSourceView().GetAllOperations[DataSourceOperation]()[0]

# Reload data source
op.Reload()

# Set current time as latest reload
Document.Properties["lastReload"] = DateTime.Now

错误消息内容:名称错误:未定义名称'table'

问题原因与修正方案

  • 核心问题:脚本中直接使用的table变量未被定义,Spotfire无法识别要操作的数据表对象。
  • 修正步骤:
    1. 先通过数据表名称获取目标数据表对象,替换成你实际的数据表名称;
    2. 再执行后续的数据操作重载逻辑。

修正后的完整脚本:

from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Data.DataOperations import *
from System import *

# 指定要操作的数据表,替换为你的数据表名称
table = Document.Data.Tables["目标数据表名称"]

# 获取数据源视图中的第一个数据操作
op = table.GenerateSourceView().GetAllOperations[DataSourceOperation]()[0]

# 重新加载该数据操作
op.Reload()

# 更新最后重载时间属性
Document.Properties["lastReload"] = DateTime.Now

额外注意事项

  • 确保lastReload属性已在Spotfire文档中创建(类型为日期时间);
  • 如果数据表包含多个数据操作,[0]表示取第一个,可根据需求调整索引值;
  • 确认当前用户拥有该数据表的编辑与重载权限。

内容的提问来源于stack exchange,提问作者user23139167

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 22:36:07