Jump to content

Script to refresh table on WEB API


Rafael Suevo

Recommended Posts

Hello,

Im trying to create an IronPython script to Refresh a data Table. The on I did is working just fine on the desktop application, the issue is when my user tries to refresh it on the web interface. Wghen i click on the button to run the script it briefly tries to run it but shows the error message "Couldt Run perform the action "Refresh" - It was not possible to execute the script 'Refresh Table': prompting inside a transactions is only allowed when the transaction is contained in a progress operation.

The Scripts Im Trying to run are like this:

from System.Collections.Generic import List, Dictionary

from Spotfire.Dxp.Data import DataTable

from System.Collections import ArrayList

 

tables = ArrayList()

Document.Data.Tables["ExternalData - Assets"].ReloadAllData()

if table.IsRefreshable and table.NeedsRefresh:

table.Refresh()and

from System.Collections.Generic import List, Dictionary

from Spotfire.Dxp.Data import DataTable

from System.Collections import ArrayList

 

tables = ArrayList()

Document.Data.Tables["BaseDadosExternos - Debentures"].ReloadAllData()I dont know exactly the difference between then, but they both work fine on the desktop. Does anyone knows hot to make it work

Thanks very much

Link to comment
Share on other sites

In this script the Refresh method call uses a transaction (to get an undo step), and prompting is not allowed inside transactions unless the outer most transaction is executed inside a progress operation. Hence to get this to work,

1)Check the "Prompt for new Settings before loading" under Edit - Data Table Properties for the required table.

2)Uncheck the "Execute in transaction", and then alter the script to use the progress service:

-----------------------------------------------------

from Spotfire.Dxp.Framework.ApplicationModel import *

#table=Document.ActiveDataTableReference

table= Document.Data.Tables["mytable"]

def Refresh():

table.Refresh()

ps = Application.GetService[ProgressService]()

ps.ExecuteWithProgress("refresh title", "refresh description", Refresh)

-----------------------------------------------------

For documentation on "Execute in transaction" below is what is documented:

https://docs.tibco.com/pub/sfire-analyst/10.5.0/doc/html/en-US/TIB_sfire...

Link to comment
Share on other sites

Hello Rayees,Thanks for you answer.

I couldnt make your script run. It starts and shows the Progress Title prompt but runs very fast (less than a second) but doesnt refresh the data-table.Im not sure if I could express my problem. My script (altough rudimentar) is running fine on the desktop client, but shows nothing when my team tries to run it on the WEB interface. Im pretty sure that the issue is related to the data origin, since it is on a .XLSX file stored on my local network. The same script is able to update tables when they are from an information link pulling data from DB2 libraryAs fas as I know, the WEB client doesnt read XLS files from the local network, correct So the refresh script is the solutions I could figure to make my team able to update informations during the day, without the need to do it trough the spotfire client (I stored the data on the analysis).Do you have any idea how I cloud make the script (or another) run on the web.Thanks in advance.

Link to comment
Share on other sites

Have already configured WebPlayer to access files from network paths If not the following knowledge base article has the information on how to configure WebPlayer to access files from network shared paths,

 

https://support.tibco.com/s/article/How-to-configure-access-to-local-and-shared-network-directories-for-the-TIBCO-Spotfire-Web-Player

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...