George Manifavas Posted November 10, 2019 Share Posted November 10, 2019 Dear all, I wrote the following script in order to refresh tables under specific conditions. I have created a document property under the name "lob". Some tables will be refreshed according to lob's value, while othes will be refreshed despite lob's value. Please note that some tables may not be refreshed at all. That's the reason for begging my script with data's deletion from every single table and then refreshing. Moreover, i have created a document propertyunder the name "PIAreadyToDisplay". This property equals "No" while tables are being refreshed.When the table's refreshis finished, the document property equals to "Yes". It seems that tables are refreshing according my needs but the document property "PIAreadyToDisplay" does not work as it should. Do you find any mistake in my script Thank you in advance for your reply. 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) Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted November 11, 2019 Share Posted November 11, 2019 In the script editor can you try to uncheck the "execute in transaction" option and see if the document property updates when the tables are refreshing. Link to comment Share on other sites More sharing options...
George Manifavas Posted November 11, 2019 Author Share Posted November 11, 2019 I tried it but nothing changed. Link to comment Share on other sites More sharing options...
George Manifavas Posted November 11, 2019 Author Share Posted November 11, 2019 Solved In order to show the value of document property "PIAreadyToDisplay": I inserted an text area I inserted a label - property control. In order to do that, i selected a table in the "Data" field and i selected my document property in the "Values" field. When the table (of step 2) was not refreshed, document property'svalue was not changed. In step 2, i selected a table which will always have been refreshed. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now