New TIBCO Community Launches Soon!

The community will temporarily be 'read-only' beginning July 8th until the launch.

Converting TERR inline expressions to Expression functions

Last updated:
11:27pm May 14, 2019

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 will 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 one 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 Spotfire 10.3, what do I do?

You need to convert it to an Expression function instead. Expression functions can be trusted by members of the script author group as described in the documentation

Below follows 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 a 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
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