简体   繁体   English

Spotfire-如何添加重新加载按钮

[英]Spotfire - How to add a reload button

How to add a button and whenever user clicks on the button the data reloads. 如何添加按钮,以及每当用户单击按钮时,数据就会重新加载。

Also the user should know when the data gets refreshed. 用户还应该知道何时刷新数据。

You could use this python script, as found here . 您可以使用此python脚本,如此处所示

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

#Refreshing a single Data table:
dataTable.Refresh() // where dataTable is a script parameter of type DataTable

#Refreshing multiple tables:
#Note that more than one table can be added to the List object.
tables = ArrayList()
tables.Add(Document.Data.Tables["DataTable1"]) 
tables.Add(Document.Data.Tables["DataTable2"]) 
Document.Data.Tables.Refresh(tables)
#As such DataTableCollection.Refresh Method refreshes the given tables in dependency order.
#OR
Document.Data.Tables.RefreshAsync(tables)
#And DataTableCollection.RefreshAsync Method (IEnumerable< DataTable> ) refreshes the given tables in dependency order. 
#Tables that have asynchronous refresh (i.e. Data On Demand and Data Functions) and tables that depend on them will be refreshed 
#in later transactions.

# Another possible option:

Tbls = List[DataTable]() 
Tbls.Add(Document.Data.Tables["DataTable1"]) 
Tbls.Add(Document.Data.Tables["DataTable2"]) 
for i in Tbls:
 Document.Data.Tables.Refresh([i])

In order to let the user know when the data was refreshed, just set a document property with the current date/time and surface that document property in a text area. 为了让用户知道何时刷新数据,只需使用当前日期/时间设置文档属性,然后在文本区域中显示该文档属性。 When the script above is run, the date/time will update. 运行上面的脚本时,日期/时间将更新。

Also, have a look at their Python API page located here (for 7.6, but the newer 7.12 API can be found as well). 另外,请查看位于此处的Python API页面(适用于7.6,但也可以找到更新的7.12 API)。 While it is organized in a slightly frustrating way, you can get a feel for methods and classes you can call in your script to do all sorts of things programmatically. 尽管它的组织方式有些令人沮丧,但您可以体会到可以在脚本中调用的方法和类,以编程方式执行各种操作。

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

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