Jump to content

How To Change Calculate Totals Using Iron Python


Oliver Drummond

Recommended Posts

I have a Cross Table in my Spotfire Dashboard and am trying to change the "Calculate Totals" option using an Iron Python script.

 

I've foundthis linkon Spotfire API. So, from what I understood, this information is stored in myVis.Totals. But, for whatever the reason, this seems to be a read-only property as can be seenhere.

Have any of you ever had this problem and would know how to fix it

This is my code:

from Spotfire.Dxp.Application.Visuals import *

 

# myVis is a script parameter of the type "Visualisation"

myVis = myVis.As[Visualization]()

myVis.Totals = CrossTableTotals.CalculationMode.SumOfCellValues

This is the error I'm getting:

Traceback (most recent call last):

File "", line 5, in

AttributeError: can't assign to read-only property Totals of type 'CrossTablePlot'

 

 

System.MissingMemberException: can't assign to read-only property Totals of type 'CrossTablePlot'

at CallSite.Target(Closure , CallSite , Object , Object )

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)

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