Jump to content

How can I dynamically replace a data table using property controls


Robert Armstrong 2

Recommended Posts

I'm trying to replace a data table in my dashboard using two property controls. The first property control is to select the column I want to create a new filter for. The second property control is to select a specific item from within the first property control (column). I have a script modified, but can't seem to get it to work with Python 2.7 and Spotfire 7.11. Param1Value is the column and Param2Value is the item within the column.

Any help to what the error here is would be greatly appreciated.

from System import Array,Guid,String,Object

from Spotfire.Dxp.Data.Import import InformationLinkDataSource, InformationLinkParameter

from Spotfire.Dxp.Data import *

 

 

#Function to return a Spotfire Data Table. Will return None if the data table does not exist

#parameter: tableName - the name of the data table in the Spotfire document

def getDataTable(tableName):

try:

return Document.Data.Tables[tableName]

except:

print ("Cannot find data table: " + tableName + ". Returning None")

return None

 

#The GUID of the information link to be executed (Right-click, Copy ID from the information designer)

ilGuid = "IL id is entered here"

 

#Build the Information Link parameters and set their values

ilParameters = []

ilParameter = InformationLinkParameter.CreateNamedParameter(param1Value, Array[object](param2Value))

ilParameters.append(ilParameter)

 

#Create the Information Link Data Source and assign the parameters

ilDataSource = InformationLinkDataSource(Guid(ilGuid))

ilDataSource.Parameters = ilParameters

 

#Add/Refresh the data table, which will execute the Information Link

actionsDtName = "Data table name is placed here."

dt = getDataTable(actionsDtName)

if dt != None:

dt.ReplaceData(ilDataSource)

else:

Document.Data.Tables.Add(actionsDtName, ilDataSource)

Link to comment
Share on other sites

  • 3 weeks later...

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