IPython脚本在Spotfire客户端上运行,而不是在Spotfire Web上运行

IPython脚本在Spotfire客户端上运行,而不是在Spotfire Web上运行,ipython,spotfire,Ipython,Spotfire,我有以下python脚本(简化了,但其余部分执行类似的操作): 从Spotfire.Dxp.Application.Visuals导入* 从Spotfire.Dxp.Data导入* #如果需要,为提示指定默认值 如果Document.Properties['cannedKPISelected'].isspace(): Document.Properties['cannedKPISelected']='GS' 如果Document.Properties['cannedTimeSelected'].

我有以下python脚本(简化了,但其余部分执行类似的操作):

从Spotfire.Dxp.Application.Visuals导入*
从Spotfire.Dxp.Data导入*
#如果需要,为提示指定默认值
如果Document.Properties['cannedKPISelected'].isspace():
Document.Properties['cannedKPISelected']='GS'
如果Document.Properties['cannedTimeSelected'].isspace():
Document.Properties['cannedTimeSelected']='Month'
#根据数据中的标志确定需要显示的viz类型
tableName='PrimaryDataTable'
ColumntToFetch='displayPercentageFlag'
activeTable=Document.Data.Tables[tableName]
rowCount=activeTable.rowCount
rowsToInclude=IndexSet(rowCount,True)
cursor1=DataValueCursor.CreateFormatted(activeTable.Columns[ColumntToFetch])
对于activeTable.GetRows(rowsToInclude,cursor1)中的行:
rowIndex=行。索引
percentageNeeded=cursor1.CurrentValue
打破
#创建消费者报告
对于文档中的页面。页面:
对于第页中的viz,视觉效果:
如果str(即Id)=‘a7f5b4ec-f545-4d5f-a967-adec4c9fec79’:
如果Document.Properties['coffeeReportSelected']=='Brand Category by Market':
如果Document.Properties['cannedKPISelected']=='GS'和Document.Properties['cannedTimeSelected']=='Month'和percentageNeeded=='Y':
visualContentObject=即作为[视觉内容]()
visualContentObject.MeasureAxis.Expression='总和([GS月])为[GS月]'
visualContentObject.RowAxis.Expression=''
visualContentObject.ColumnAxis.Expression=''
visualContentObject.ShowColumnGrandTotal=True
visualContentObject.ShowColumnSubtotals=True
visualContentObject.ShowRowGrandTotal=False
visualContentObject.Title=‘按品牌、市场划分的月度GS’
visualContentObject.Data.WhereClauseeExpression='[NAME]=“CANADA”'
visualContentObject.CellWidth=125
Document.Properties['cannedreporthiderrows']='Sum(Abs(序号[GS月],0))'
elif Document.Properties['cannedKPISelected']='GS'和Document.Properties['cannedTimeSelected']='Quarter'和percentageNeeded=='Y':
visualContentObject=即作为[视觉内容]()
visualContentObject.MeasureAxis.Expression='Sum([GS Quarter])as[GS Qtr]'
visualContentObject.RowAxis.Expression=''
visualContentObject.ColumnAxis.Expression=''
visualContentObject.ShowColumnGrandTotal=True
visualContentObject.ShowColumnSubtotals=True
visualContentObject.ShowRowGrandTotal=False
visualContentObject.Title=‘按品牌、市场划分的季度GS’
visualContentObject.Data.WhereClauseeExpression='[NAME]=“CANADA”'
visualContentObject.CellWidth=125
Document.Properties['cannedreporthiderrows']='Sum(资产负债表(序号[GS季度],0))'
诸如此类

这个脚本(和其他脚本)在客户端运行得非常好。它不在网络上运行。web会说processing,然后说ready(在左下角),同时什么也不做(没有错误,什么也不做)。我在同一分析中使用的其他一些脚本运行得非常好

我知道出于安全原因,web上的IPython脚本有一些限制,但我只是在构建一个表。这是不能限制的,不是吗?Web服务器日志不会捕获任何异常情况

我们正处于焦点7.6


更新:这似乎是因为:
如果str(即Id)='a7f5b4ec-f545-4d5f-a967-adec4c9fec79':
。不幸的是,这是因为Web和客户端之间的ID不同。知道我的标题也发生了变化,关于我可以通过什么来引用客户机和web之间保持不变的可视化,有什么想法吗?

您能找出当前可视化上的索引并以这种方式引用它吗

尝试以下方法: 替换此行:

if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':
与:


不确定这是否是您的想法,但我相信这将为您提供一种无需使用ID即可参考可视化的方法。

因为Spotfire会根据vis是否在web播放器上或客户端上更改其ID,因此脚本无法按预期工作。我只是简单地添加了vis作为一个参数,而不是依赖脚本去定位正确的vis。当vis的名称更改时,参数将正确更新,因此它仍然是动态的

if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':
if viz[0] (or whatever the index is)