Jump to content

Replace InformationLinkDataSource on DataCanvas using Data Table Source View API


Giuseppe Amador

Recommended Posts

Hello,

 

I'm trying to replace a information link data source on the data canvas using the Data Table Source View API.

 

I'm using the following code:

 

from Spotfire.Dxp.Data import *

from Spotfire.Dxp.Data.DataOperations import *

from System import *

from System.Collections.Generic import List

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

 

table = Document.Data.Tables["Ao VIS"]

 

# Get the first data source from the Source View

#op = table.GenerateSourceView().GetAllOperations[DataSourceOperation]()

 

for op in table.GenerateSourceView().GetAllOperations[DataSourceOperation]():

print op.DisplayName

print op.CanReplaceDataFlow()

print op.Inputs

 

 

tempList = []

 

# convert parameter to a List, while removing the pipe separator

tempList = filter(None, "maio".split("||"))

 

# convert the List into an Array

param1Values = Array[str](tempList)

 

 

tempList = filter(None, "903970369".split("||"))

param2Values = Array[str](tempList)

 

# creating the parameter object

param1 = InformationLinkParameter.CreateNamedParameter("mes", param1Values)

param2 = InformationLinkParameter.CreateNamedParameter("cd_cli", param2Values)

 

 

ilds = InformationLinkDataSource("f29ad099-912f-474a-b7a2-2bd0fc108680", [param1,param2])

print ilds.Parameters

 

dfb = DataFlowBuilder(ilds, Application.ImportContext)

 

flow = dfb.Build()

 

#op.ReplaceDataFlow(flow)

When executing the method Build from the DataFlowBuilder, I'm getting the following error:

 

Traceback (most recent call last):

File "", line 40, in

SystemError: Object reference not set to an instance of an object.

 

System.NullReferenceException: Object reference not set to an instance of an object.

at Spotfire.Dxp.Data.DataFlowBuilder.get_DocumentTitle()

at Spotfire.Dxp.Data.DataFlowBuilder.Build(Boolean useInitialResult)

at Microsoft.Scripting.Interpreter.FuncCallInstruction`2.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.Run2[T0,T1,TRet](T0 arg0, T1 arg1)

at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)

at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)

at Spotfire.Dxp.Application.IronPython27.IronPythonScriptEngine.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)

 

Can anyone help

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