简体   繁体   English

树状图表达式中属性的语法 - spotfire 分析员 10.8

[英]syntax for properties in treemap expressions - spotfire analyst 10.8

I'm trying to create a treemap with user inputs for column selection in the hierarchy.我正在尝试使用用户输入创建一个树状图,用于层次结构中的列选择。 I've got three (drop-down) document properties called treemap1, treemap2, & treemap3, the values of each are strings with column names.我有三个(下拉)文档属性,称为 treemap1、treemap2 和 treemap3,每个属性的值都是带有列名的字符串。 I'm struggling with the expression for the hierarchy axis.我正在努力处理层次轴的表达式。 If I use...如果我用...

<${treemap1} NEST ${treemap2} NEST ${treemap3}>

...the visualization works fine. ...可视化效果很好。 I would however like to add a "none" option for the second & third controls, but when I do, once either is set to "none", the visualization doesn't render and gives the error "the expression is not valid after NEST...".然而,我想为第二个和第三个控件添加一个“无”选项,但是当我这样做时,一旦将其中一个设置为“无”,可视化就不会呈现并给出错误“在 NEST 之后表达式无效……”。 This makes sense because [column] NEST null NEST null isn't a valid expression.这是有道理的,因为[column] NEST null NEST null不是有效的表达式。 So i'd like to add a case statement to get around the problem, to check for null values and change the expression accordingly.所以我想添加一个 case 语句来解决这个问题,检查空值并相应地更改表达式。 I've tried various permutations of this:我已经尝试了这个的各种排列:

<
case    
    when "${treemap2}" ="" and "${treemap3}" ="" then ${treemap1}
    when "${treemap2}" ="" then ${treemap1} NEST ${treemap3}
    when "${treemap3}" ="" then ${treemap1} NEST ${treemap2}
    else ${treemap1} NEST ${treemap2} NEST ${treemap3}
end
>

...but it never lets me save, always returning "the expression is not valid after NEST on line 4". ...但它从不让我保存,总是返回“在第 4 行的 NEST 之后表达式无效”。 I assume this is a syntax issue but I am stuck.我认为这是一个语法问题,但我被卡住了。 So my questions are 1) can I use a case statement this way on a categorical axis and 2) if so, what needs to change in order for Spotfire to accept it?所以我的问题是 1) 我可以在分类轴上以这种方式使用 case 语句吗 2) 如果是这样,需要更改什么才能让 Spotfire 接受它?

Thanks in advance...提前致谢...

Best would be to add 3 buttons, each one associated to an ironpython script that takes the visualization as parameter (let's call it vis ).最好的办法是添加 3 个按钮,每个按钮都与一个以可视化为参数的 Ironpython 脚本相关联(我们称之为vis )。

from Spotfire.Dxp.Application.Visuals import Treemap

vis.As[Treemap]().HierarchyAxis.Expression = "<${treemap1} NEST ${treemap2} NEST ${treemap3}>"

Do the same for the 2 others, with expression <${treemap1} NEST ${treemap2}> and <${treemap1}> .对另外 2 个执行相同的操作,表达式<${treemap1} NEST ${treemap2}><${treemap1}>


You can even have only one script for the 3 buttons by setting the expression as parameter (let's call it e ) :通过将表达式设置为参数(我们称之为e ),您甚至可以只为 3 个按钮创建一个脚本:

from Spotfire.Dxp.Application.Visuals import Treemap

vis.As[Treemap]().HierarchyAxis.Expression = e

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

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