Ash Mishra Posted February 25, 2019 Share Posted February 25, 2019 Is there a way to add a button that allows you to bring up the prompt so that you can re-select your parameters I have tried the below to refresh table and assigned to a button, but that does not necessarily bring up the prompt again. from Spotfire.Dxp.Data import * from Spotfire.Dxp.Data.Import import * # Refresh all tables for table in Document.Data.Tables: if table.IsRefreshable: table.Refresh() Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted February 25, 2019 Share Posted February 25, 2019 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, you would need to untick the "Execute in transaction" in the script editor, and then alter the script to use the progress service: from Spotfire.Dxp.Framework.ApplicationModel import * def Refresh(): # define script parameter "table" to be refreshed table.Refresh() ps = Application.GetService[ProgressService]() ps.ExecuteWithProgress("refresh title", "refresh description", Refresh) Link to comment Share on other sites More sharing options...
Ash Mishra Posted February 25, 2019 Author Share Posted February 25, 2019 Thank you. When attempted to do what you have suggested, now I am stuck at the below error whenever I click the newly created button. global name 'table' is not defined at IronPython.Runtime.Operations.PythonOps.GetVariable(CodeContext context, String name, Boolean isGlobal, Boolean lightThrow) at IronPython.Compiler.LookupGlobalInstruction.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at Spotfire.Dxp.Forms.Application.FormsProgressService.ProgressThread.DoOperationLoop() Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted February 25, 2019 Share Posted February 25, 2019 You need to add an Script Parameter called "table" referring to a particular data table or modify the Refresh() method as below def Refresh(): # define script parameter "table" to be refreshed for table in Document.Data.Tables: if table.IsRefreshable: table.Refresh() Link to comment Share on other sites More sharing options...
Ash Mishra Posted February 25, 2019 Author Share Posted February 25, 2019 Works perfectly on client. However, via webplayer I receive the below error: Failed to prompt using model: ConnectionPromptModel at Spotfire.Dxp.Data.DataTable.b__1a(Exception e) at Spotfire.Dxp.Data.DataTable.BeginRefresh(Boolean showDataLoadReport, Boolean async, Action`1 continuation, DisposableCollection disposableCollection, Predicate`1 isLeafAffected, Boolean refreshEmbeddedSources, DataLoadSettings loadSettings) at Spotfire.Dxp.Data.DataTable.Refresh(Boolean showDataLoadReport, Predicate`1 isLeafAffected, Boolean refreshEmbeddedSources, DataLoadSettings loadSettings) at Spotfire.Dxp.Data.DataTable.Refresh() at Microsoft.Scripting.Interpreter.ActionCallInstruction`1.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at Spotfire.Dxp.Web.WebProgressService.Spawn(String title, String description, ProgressOperation operation, Boolean showCancelButton) Link to comment Share on other sites More sharing options...
ankur agarwal 2 Posted August 26, 2019 Share Posted August 26, 2019 Anyone got a solution of how to make this work in web player. getting this error Failed to prompt using model: SequentialPromptModel at Spotfire.Dxp.Data.DataTable.c.b__246_0(Exception e) at Spotfire.Dxp.Data.DataTable.BeginRefresh(Boolean reportColumnsChangedResultToNotificationService, Boolean async, Action`1 continuation, DisposableCollection disposableCollection, Predicate`1 isLeafAffected, Boolean refreshEmbeddedSources, DataLoadSettings loadSettings) at Spotfire.Dxp.Data.DataTable.Refresh(Boolean reportColumnsChangedResultToNotificationService, Predicate`1 isLeafAffected, Boolean refreshEmbeddedSources, DataLoadSettings loadSettings) at Spotfire.Dxp.Data.DataTable.Refresh() at Microsoft.Scripting.Interpreter.ActionCallInstruction`1.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at Spotfire.Dxp.Web.WebProgressService.Spawn(String title, String description, ProgressOperation operation, Boolean showCancelButton) Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted August 26, 2019 Share Posted August 26, 2019 It is not possible to show prompts in WebPlayer currently. The script in this forum works only in Spotfire Analyst 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