Jump to content
  • Converting TERR inline expressions to Expression functions


    In Spotfire 10.3 and later, as an effect of introducing the data function trust feature, TERR Inline expressions can only be executed in the restricted execution mode of TERR. This means that any inline expressions using constructs that cannot be executed in the restricted execution mode fail, and they must be converted to Expression functions that can be trusted.

    What is a TERR inline expression?

    An inline expression is when you are using TERR directly on the axis of a visualization, as a custom expression. This is done by using of the functions of the expression language that are prefixed with TERR_ in the expression. See the full list in the statistical functions section of the help.

    If my inline expression can no longer be executed in my version of Spotfire, what can I do?

    Convert your inline expression into an Expression function instead. Expression functions can be trusted by members of the script author group as described in the documentation

    Below is an example of how to convert an inline expression to an expression function. 

    The visualization in this example uses the R function kmeans to color the markers in the scatter plot. 

    inline_terr_expression.png.3a229681082c174713bfad551fbc06b8.png

     

    Here is what the inline expression looks like:

    2.png.ff0d4a6318e2136e8584fba602450162.png

    To convert this inline expression to an expression function we first follow the steps in creating an expression function. When it comes to adding the script code we will paste the following snippet:

    nkmeans <-function(input1,input2,input3) 
    {
       km <- kmeans(data.frame(input1, input2, input3),3)$cluster km 
    } 
    output <- nkmeans(input1,input2,input3)
     

    Here is a screenshot of the dialog:

    inline_expression_2.png.057a40c37eafed445077f968129d653a.png

    Then, on the color axis of the visualization, we will now use the new expression function instead of the inline expression:

    5.png.8de94aed7b82c401035d6bc3281d5e70.png

    Then we are done. The visualization looks like before; the only difference is the expression on the color axis.

    inline_terr_expression2.png.aceacde1a1e2fa9aaa9bcc5ea63b73eb.png

     

    Read more about data function trust in the following articles

    Script and data function trust in Spotfire 10.3 and later

    FAQ about script and data function trust


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...