繁体   English   中英

Tibco 点火; 使用ironpython在条件下刷新表

[英]Tibco spotfire; Refresh tables under conditions using ironpython

为了在特定条件下刷新表格,我编写了以下脚本。

我创建了一个名为“lob”的文档属性。

一些表将根据 lob 的值进行刷新,而另一些表将根据 lob 的值进行刷新。

请注意,某些表格可能根本不会刷新。 这就是请求我的脚本从每个表中删除数据然后刷新的原因。

此外,我创建了一个名为“PIAreadyToDisplay”的文档属性。 在刷新表时,此属性等于“否”。 当表格的刷新完成时,文档属性等于“是”。

似乎表格正在根据我的需要刷新,但文档属性“PIAreadyToDisplay”不能正常工作。

你发现我的剧本有什么错误吗?

预先感谢您的回复。

**Script**

Document.Properties["PIAreadyToDisplay"] = "No"

import clr

from Spotfire.Dxp.Data import RowSelection, IndexSet

MyTable = Document.Data.Tables["In Force"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["ACP_IF"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["NAYO_IF"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["In Force"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["pol_start_dt"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["Policy_Info_Fire_append_non_fire"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["policy_info_covers_mani"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["Intermediaries"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["Policy_Info_HH _with_Descriptions"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["Policy_info_Companies_with_descriptions"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

MyTable = Document.Data.Tables["policy_multiple_Usages"]

MyTable.RemoveRows(RowSelection(IndexSet(MyTable.RowCount,True)))

import clr

from System.Collections.Generic import List, Dictionary

from Spotfire.Dxp.Data import DataTable

from Spotfire.Dxp.Framework.ApplicationModel import NotificationService



--- Empty list to hold DataTables

Tbls = List[DataTable]()

str1 = Document.Properties["lob"] ;

str2 = "5049242";

if (str2 in str1)==True:

Tbls.Add(ACP)

str3 = "5049234";

if (str3 in str1)==True:

Tbls.Add(NAYO_IF)

str4 = "Πυρός";

if (str4 in str1)==True:

Tbls.Add(house)

Tbls.Add(companies)

Tbls.Add(use)



Tbls.Add(polstart)

Tbls.Add(interm)

Tbls.Add(covers)


--- Notification service

notify = Application.GetService[NotificationService]();

--- Execute something after tables are loaded

def afterLoad(exception, Document=Document, notify=notify):

if not exception:

  Document.Properties["PIAreadyToDisplay"] = "Yes"



else:

  notify.AddErrorNotification("Error refreshing table(s)","Error details",str(exception))

--- Refresh table(s)

Document.Data.Tables.RefreshAsync(Tbls, afterLoad)

解决了

为了显示文档属性“PIAreadyToDisplay”的值:

  1. 我插入了一个文本区域 我插入了一个 label - 属性控件。
  2. 为此,我在“数据”字段中选择了一个表格,并在“值”字段中选择了我的文档属性。 当表(步骤 2)未刷新时,文档属性的值未更改。

在第 2 步中,我选择了一个始终会刷新的表。

暂无
暂无

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

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