简体   繁体   English

Spotfire如何更改使用Iron Python计算总数

[英]Spotfire How To Change Calculate Totals Using Iron Python

I have a Cross Table in my Spotfire Dashboard and am trying to change the "Calculate Totals" option using an Iron Python script. 我的Spotfire信息中心中有一个交叉表,并且正在尝试使用Iron Python脚本更改“计算总计”选项。

在此处输入图片说明

I've found this link on Spotfire API. 我在Spotfire API上找到了此链接 So, from what I understood, this information is stored in myVis.Totals. 因此,据我了解,此信息存储在myVis.Totals中。 But, for whatever the reason, this seems to be a read-only property as can be seen here . 但是,无论出于何种原因,这似乎是一个只读属性可以看出这里

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 "<string>", line 5, in <module>
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)

Try this 尝试这个

myVis.Totals.DefaultCalculationMode=CrossTableTotals.CalculationMode.SumOfCellValues myVis.Totals.DefaultCalculationMode = CrossTableTotals.CalculationMode.SumOfCellValues

Gaia 盖亚

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM