У меня есть перекрестная таблица на панели инструментов Spotfire, и я пытаюсь изменить параметр «Рассчитать итоги», используя скрипт Iron Python.
Я нашел эта ссылка в Spotfire API. Итак, насколько я понял, эта информация хранится в myVis.Totals. Но по какой-то причине это свойство доступно только для чтения, как видно из здесь.
Кто-нибудь из вас когда-либо сталкивался с этой проблемой и знает, как ее решить?
Это мой код:
from Spotfire.Dxp.Application.Visuals import *
# myVis is a script parameter of the type "Visualisation"
myVis = myVis.As[Visualization]()
myVis.Totals = CrossTableTotals.CalculationMode.SumOfCellValues
Это ошибка, которую я получаю:
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)
Попробуй это
myVis.Totals.DefaultCalculationMode=CrossTableTotals.CalculationMode.SumOfCellValues
Гея
ИМЕННО то, что мне было нужно, Гайя! Большое спасибо!