簡體   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