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.
how to send user selected values to a script - TIBCO Spotfire Community

how to send user selected values to a script

Last post Wed, Dec 12 2012 12:47 PM by sivaspotfire. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • Fri, Aug 3 2012 4:42 AM

    how to send user selected values to a script

    Description of the Requirement:

    I have two dropdowns – 
    First Dropdown named X -contains values 5,10,15
    Second Dropdown named Y – contains values 2,4,6
    I have to calculate & show the value “SUM” where SUM = X+Y and SUM is calculated for the user selected value of X & Y

    How do I do this? How to perform calculation on user selected value in the dropdown (property control)
  • Mon, Aug 6 2012 3:16 PM In reply to

    Re: how to send user selected values to a script

    create 3 properties, first one (drop down list for the first number) ,second one (drop down list for second number) ,and third prop for label. Create a button action control too

    Inside script add these lines :

    propLabel = "Sum : "  + (Document.Properties("propFirstValue") + Document.Properties("propSecondValue"))

    print propLabel // this print helps u for testing, it prints the o/p on console.

    Try this and let me know the results.

    Thanks 

     

     

  • Mon, Aug 6 2012 9:31 PM In reply to

    Re: how to send user selected values to a script

    hi siva

    Thanks a lot for this.

    I am still in the learning phase and m stil not familiar with the tool.

    Once i run the script i got the following error

    DocumentProperties is not callable
       at _stub_$21##21(Closure , CallSite , CodeContext , Object , String )
       at Microsoft.Scripting.Actions.MatchCaller.Call3[T0,T1,T2,TRet](Func`5 target, CallSite site, Object[ args)
       at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[ args)
       at Microsoft.Scripting.Actions.UpdateDelegates.Update3[T,T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
       at <module>$19##19(Closure , Scope , LanguageContext )
       at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope)
       at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
       at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
       at Spotfire.Dxp.Application.ScriptSupport.IronPythonScriptEngine.Execute(ScriptDefinition script, Dictionary`2 scope)
       at Spotfire.Dxp.Application.Scripting.ScriptService.Execute(ScriptDefinition script, Dictionary`2 scope)
       at Spotfire.Dxp.Application.Scripting.ScriptManager.<>c__DisplayClass4.<ExecuteScript>b__3()
       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)

    I have names the first drop down as Xvalue and the second as Yvalue, and the label has been names as Sum

  • Wed, Aug 8 2012 11:54 AM In reply to

    Re: how to send user selected values to a script

    Sharath,

    as siva said, u have to use 3properties. 3rd property = prop1 + prop2.

    on text area show it like Sum = <controltype = label with value = 3rd property>

    Another way is to use calculated column and show it for all rows in the data table.

    Kiran
  • Wed, Dec 12 2012 12:47 PM In reply to

    Re: how to send user selected values to a script

    try like this

    X:     OneTwoThree   Y : FourFiveSix          9

    script code :

    a= Document.Properties["propOne"]
    b= Document.Properties["propTwo"]
    c=int(a)+int(b)
    Document.Properties["propLabel"]=c
    print Document.Properties["propLabel"]

    (or)

    Document.Properties["propLabel"]=int(Document.Properties["propOne"])+int(Document.Properties["propTwo"])

    print Document.Properties["propLabel"]

    try this and let me know. Thanks.

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