The Spotfire Community is moving to TIBCOmmunity and this forum location has closed. During the transition, you can still search the old forums but posting has been disabled. We encourage you to pick up the discussion at the new Spotfire community on TIBCOmmunity.
Script to Refresh Data Table - TIBCO Spotfire Community

Script to Refresh Data Table

Last post Mon, Dec 3 2012 8:16 AM by sivaspotfire. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • Wed, Jun 13 2012 7:22 AM

    • scolacr
    • Top 100 Contributor
    • Joined on Tue, May 10 2011
    • Posts 21

    Script to Refresh Data Table

    Does anyone have an Iron Python script written that will refresh a data table?  I just need to be able to click a button to refresh a particular data table.

    Thanks!
    Cathy

  • Wed, Jun 13 2012 7:29 AM In reply to

    • jcskalant
    • Top 10 Contributor
    • Joined on Sun, Aug 21 2011
    • Panamá
    • Posts 258

    Re: Script to Refresh Data Table

    Hi Cathy,

    I use something like this:

    if myDocument.Data.Tables.Contains("infolk_Con_Ids_VistaMensualPos")==True:

    myTable=myDocument.Data.Tables["infolk_Con_Ids_VistaMensualPos"]

    if myTable.IsRefreshable and myTable.NeedsRefresh:

    myTable.Refresh()

    Hope this works.

    Have a great day!

    JC

    Juan Carlos Escalante
  • Wed, Jun 13 2012 7:39 AM In reply to

    • jcskalant
    • Top 10 Contributor
    • Joined on Sun, Aug 21 2011
    • Panamá
    • Posts 258

    Re: Script to Refresh Data Table

    Hi Cathy,

    I forgot some declaration statements on the previous script...

    from Spotfire.Dxp.Application import *

    from Spotfire.Dxp.Application.Visuals import *

    myDocument=Application.Document

    if myDocument.Data.Tables.Contains("infolk_Con_Ids_VistaMensualPos")==True:

    myTable=myDocument.Data.Tables["infolk_Con_Ids_VistaMensualPos"]

    if myTable.IsRefreshable and myTable.NeedsRefresh:

    myTable.Refresh()

    Sorry :$

    JC

    Juan Carlos Escalante
  • Wed, Jun 13 2012 7:56 AM In reply to

    • scolacr
    • Top 100 Contributor
    • Joined on Tue, May 10 2011
    • Posts 21

    Re: Script to Refresh Data Table

    Thanks JC!  Actually, all I needed was the one line, myTable.Refresh() and it works exactly like I need it to.  You're the best!

    Cathy

  • Wed, Jun 13 2012 8:25 AM In reply to

    Re: Script to Refresh Data Table

    Thanks JC. I have syntax error as below, Do you know why?

    Microsoft.Scripting.SyntaxErrorException: expected an indented block
       at Microsoft.Scripting.ErrorSink.Add(SourceUnit source, String message, SourceSpan span, Int32 errorCode, Severity severity)
       at IronPython.Compiler.Parser.ReportSyntaxError(Token t, SourceSpan span, Int32 errorCode, Boolean allowIncomplete)
       at IronPython.Compiler.Parser.ParseSuite()
       at IronPython.Compiler.Parser.ParseIfStmtTest()
       at IronPython.Compiler.Parser.ParseIfStmt()
       at IronPython.Compiler.Parser.ParseStmt()
       at IronPython.Compiler.Parser.ParseFile(Boolean makeModule)
       at IronPython.Runtime.PythonContext.ParseSourceCode(SourceUnit sourceUnit, PythonCompilerOptions options, ErrorSink errorSink, Boolean& disableInterpreter)
       at IronPython.Runtime.PythonContext.CompileSourceCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink, Boolean interpret)
       at IronPython.Runtime.PythonContext.CompileSourceCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink)
       at Microsoft.Scripting.SourceUnit.Compile(CompilerOptions options, ErrorSink errorSink)
       at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
       at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
       at Spotfire.Dxp.Application.ScriptSupport.IronPythonScriptEngine.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)
       at Spotfire.Dxp.Application.Scripting.ScriptService.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)
       at Spotfire.Dxp.Application.Scripting.ScriptManager.<>c__DisplayClass14.<ExecuteScriptForDebugging>b__f()
       at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(String displayName, Executor executor, Boolean visible, Boolean sticky, Guid stickyGuid)
       at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(String displayName, Executor executor)
       at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.Transaction(String displayName, Executor executor)
       at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.Spotfire.Dxp.Framework.DocumentModel.ITransactions.ExecuteTransaction(Executor executor)
       at Spotfire.Dxp.Application.Scripting.ScriptManager.ExecuteScriptForDebugging(String scriptCode, Dictionary`2 scriptArguments, String& output)
       at Spotfire.Dxp.Forms.Framework.Scripting.ScriptEditDialog.RunButton_Click(Object sender, EventArgs e)

    Jesus answered, “I am the way and the truth and the life. No one comes to the Father except through me. John 14:6
  • Wed, Jun 13 2012 9:04 AM In reply to

    • jcskalant
    • Top 10 Contributor
    • Joined on Sun, Aug 21 2011
    • Panam&amp;#225;
    • Posts 258

    Re: Script to Refresh Data Table

    Hi John,

    Some indentation is missing in the code you are executing... if you happened to copy and paste this code directly to your Dxp file you might get this error because the code pasted doesn't keep the indentation...

    Please make sure your code looks like the one on the attached image.

    I'm still trying to figure out how to keep the format of the code when I post in the foroum :S

    Have a great day!

    JC

    Juan Carlos Escalante
  • Wed, Jun 13 2012 9:56 AM In reply to

    Re: Script to Refresh Data Table

    Hi JC,

    Can you please send the image again, its not visible actually.

    Also, what would be usecase for this? I think, in the webplayer if we wants to refresh a particular datatable? hmm But then , when we open the viz in the webplayer the data loads isnt it? Apart from this why should we need to click the button and refresh the datatable?

    Thanks,

    John

    Jesus answered, “I am the way and the truth and the life. No one comes to the Father except through me. John 14:6
  • Wed, Jun 13 2012 10:06 AM In reply to

    • scolacr
    • Top 100 Contributor
    • Joined on Tue, May 10 2011
    • Posts 21

    Re: Script to Refresh Data Table

    John - The reason I asked for the script is because I pull on-demand data through an information link by marking data on the screen.  Then I add columns from that table & from another table to create a third table which updates a map visualization.  That third table wasn't updating automatically when I marked new data, so I needed a way to update it with a button. 

    I just needed that one refresh command and now it works perfectly. 

    Cathy

  • Wed, Jun 13 2012 10:41 AM In reply to

    Re: Script to Refresh Data Table

    Ok, Thanks Cathy for the info.

    I wonder why your third table won't update automatically? Do you see any issue?

    Because of that ,Now you are having an manual process isnt it? Refresh upon Button action.

    Thanks,

    John

    Jesus answered, “I am the way and the truth and the life. No one comes to the Father except through me. John 14:6
  • Wed, Jun 13 2012 10:52 AM In reply to

    • scolacr
    • Top 100 Contributor
    • Joined on Tue, May 10 2011
    • Posts 21

    Re: Script to Refresh Data Table

    I'd love for that third table to update automatically, but I'm not sure why it doesn't.  It's linked to the source, which are the two other tables that get updated when I mark a row.  I don't know if it's a bug or if there's a different way to set it up where it would update when the marking changes.

    Cathy

  • Wed, Jun 13 2012 11:00 AM In reply to

    Re: Script to Refresh Data Table

    Hi Cathy,

    It should update, may be you are doing some thing wrong with the linking process during the Add on-demand Data Table. I am sure Button and Script is not required for this

    You might want to check "Define Input", Check "Load automatically" and check around other options, tough to pin point the issue with out seeing the Visualization.

    If manual button click process really makes an inconvenience to users and negative impact to the Spotfire tool, then I would recommend to open a support ticket.

    Thanks,

    John

    Jesus answered, “I am the way and the truth and the life. No one comes to the Father except through me. John 14:6
  • Thu, Nov 15 2012 2:52 PM In reply to

    Re: Script to Refresh Data Table

    Can any one tell me how to reset all filters using Iron Python script.

    Please share if any . Thanks.

  • Fri, Nov 30 2012 1:29 PM In reply to

    • bunny
    • Top 100 Contributor
    • Joined on Thu, Oct 18 2012
    • Posts 20

    Re: Script to Refresh Data Table

    Actually we can find reset filters optioin in functions tab in the available actions when you open the insert action control. Do we need iron python script? correct me if i am wrong.

  • Mon, Dec 3 2012 8:16 AM In reply to

    Re: Script to Refresh Data Table

    bunny, yea i know that there is a function to reset the filters. But i need tat reset should happen thru script based on several other requirements. Please let me know is there any way to implement the functionality of "Reset All Filters" function using Iron Python script.

     Greatly Appreciated your help!!. Thanks.

Page 1 of 1 (14 items)
©Copyright 2000-2011 TIBCO Software Inc | Privacy Policy | Terms of Use I Blog I Contact Us I Content Center