如何更新所有表并动态获取表名?

约翰

我在 Tibco Spotfire 工作,想要一种方法来更新分析中的所有数据源。这可以使用此处描述的脚本完成:Spotfire - 如何添加重新加载按钮

我是这样实现的:

# * * *
#
# Update tables based on:
# https://stackoverflow.com/questions/49997755/spotfire-how-to-add-a-reload-button
#
# * * *

import ctypes
from System.Collections.Generic import List, Dictionary 
from Spotfire.Dxp.Data import DataTable 
from System.Collections import ArrayList

ctypes.windll.user32.MessageBoxW(0, "About to refresh all data from databases...", "Data Update", 1)

tables = ArrayList()
tables.Add(Document.Data.Tables["raw_table_col_detail"]) 
tables.Add(Document.Data.Tables["age_group"]) 
Document.Data.Tables.Refresh(tables)

ctypes.windll.user32.MessageBoxW(0, "Done with update.", "Data Update", 1)

我现在想实现这一点,以便它适用于任何分析。如何获取可用表的列表,然后遍历该列表(即如何动态执行上述操作而不必指定表名、“raw_table_col_detail”、“age_group”等)。

Monte_fisto

根据您使用的 Spotfire 版本,这里列出了几个选项https://community.tibco.com/wiki/how-refresh-or-reload-data-using-ironpython-script-tibco-点火

您可以遍历它们并一次刷新一个

import ctypes
ctypes.windll.user32.MessageBoxW(0, "About to refresh all data from databases...", "Data Update", 1)
for t in Document.Data.Tables:
    t.Refresh()
ctypes.windll.user32.MessageBoxW(0, "Done with update.", "Data Update", 1)

或者您可以将它们推送到数组并一起刷新

import ctypes
from System.Collections import ArrayList
tables = ArrayList()
for t in Document.Data.Tables:
    tables.Add(t)
ctypes.windll.user32.MessageBoxW(0, "About to refresh all data from databases...", "Data Update", 1)
Document.Data.Tables.Refresh(tables)
ctypes.windll.user32.MessageBoxW(0, "Done with update.", "Data Update", 1)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何使用类别更新所有工作表

如何使用数据表更新所有表中的所有单元格

如何用动态表名更新表?

使用表 y 中的插入 id 更新所有表 x 行

如何使用Access VBA更新所有ODBC链接的SQL Server表的服务器名称

如何从数据库获取所有表名?

如何获取所有表名和不循环的模式

如何使用Exception在Postgresql上获取所有表名?

如何更新所有子模块?

Django的。如何更新所有会话?

获取Redshift中的所有表名

用表中的给定年份更新所有时间戳

我可以使用auto_increment(mysql)更新所有主键表吗?

如何更新數據庫所有表中名為“ModifiedBy”的所有列

与雄辩/ Laravel 5.3更新我的表保存()正在更新所有行而不是一个

PostgreSQL,获取所有分区表名和所有未分区表名

具有参数的PHP函数可更新MySQL表中的所有列,但不需要所有参数,也不总是更新所有列

如何使用javascript或jquery从动态表中获取所有tablecell值

带有连接和动态表名的更新语句

如何获取Android sqlite数据库中的所有表名?

SQLite,如何获取数据库中的所有表名?

如何在Yii Framework中从数据库中获取所有表名和列名

如何获取特定存储过程中使用的所有表名?

如何获取与mysql 8.0中的特定正则表达式匹配的所有表名?

如何更新所有行以截断毫秒

如何从 jsonArray 放置/更新所有 json 属性

使用 BigQuery DML 时如何更新所有列

迁移到AndroidX后,如何更新所有库?

如何根据每个 id 更新所有行