Search code examples
spotfire

Spotfire: how to access calculated value programatically


So, for example to access/change the "limit data using expression" property corresponding to a barchart I do:

from Spotfire.Dxp.Application.Visuals import BarChart
chart1 = Viz.As[BarChart]()
filter = '[CS_AGE] Is Not Null'
chart1.Data.WhereClauseExpression = filter

My question is: how can I access the "limit data using expression" property corresponding to a calculated values (The ones you create in a text filed using "insert dynamic item>calculated values")


Solution

  • there's probably a way to directly modify a control via the API if you know its ID (which you can get by adding the control and then looking at the HTML of its parent textarea), but I don't know what it's called.

    that said, if you just need to change the expression being used for a Calculated Value, it'd be much simpler to use a Document Property instead. in your script, you can use

    Document.Properties["MyPropertyName"] = "[Column] > 100"
    

    and then in your Calculated Value (and any charts using the same limit), set the data limiting expression to

    ${MyPropertyName}