简体   繁体   中英

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. 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...". This makes sense because [column] NEST null NEST null isn't a valid expression. So i'd like to add a case statement to get around the problem, to check for null values and change the expression accordingly. 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". 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?

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

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


You can even have only one script for the 3 buttons by setting the expression as parameter (let's call it e ) :

from Spotfire.Dxp.Application.Visuals import Treemap

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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