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. 



    Here is what the inline expression looks like:


    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:


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


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



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