Jump to content

How do you read Iron Python Script Parameter Values


Michael Frey

Recommended Posts

How does one read a passed value within an Iron Python script. I am attempting to use a Link in a visualization that has a parameter from which I will set a Document Property to control the context of the target Page I found "How to Execute an IronPython Script with Multiple Input Parameters from within Another IronPython Script in TIBCO Spotfire Using IronPython Scripting" that reads the parameter name and description but stops short of showing how to read the value passed to the script, any examples/ideas Thx
Link to comment
Share on other sites

Hello Michael,

 

In the example two parameters a visual and a string are passed to the script "MyScript"

 

The values passed are defined by

 

visual = Document.ActivePageReference.ActiveVisualReference

 

and 

 

MyInputString':'Hello world!'

 

and In the script "MyScript" there should be two script parameters with the names MyInputString and MyInputVis

Link to comment
Share on other sites

  • 1 year later...

I am trying to call a Script2 with Parameter from Script1. My Script parameter is referring to a Datatable Visualization . Can someone let me know the Line of Code for this. 

 

 

 

Below is what i have done:

 

Script 1:

 

from Spotfire.Dxp.Application.Scripting import ScriptDefinition,ScriptParameterType as type
from System.Collections.Generic import Dictionary
import clr
scriptDef = clr.Reference[scriptDefinition]()

Document.ScriptManager.TryGetScript("Script2", scriptDef)

dt = Document.Data.Tables.DefaultTableReference
print dt.Name
paramDict = {'viz':dt} 
params = Dictionary[str, object](paramDict)
Document.ScriptManager.ExecuteScript(scriptDef.ScriptCode, params)

 

 

 

Script2:

 

rom Spotfire.Dxp.Application.Visuals import *
from Spotfire.Dxp.Application.Visuals.ValueRenderers import *
from Spotfire.Dxp.Data import DataPropertyClass

viz = viz.As[VisualContent]()
myTable = viz.Data.DataTableReference
print myTable.Name

myColumn=myTable.Columns.Item["Column"]
.
.
.
(Lot Many lines involved based on req).

 

Can someone please suggest where i was doing wrong.

 

Thanks.

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...