TERR_String
In the Spotfire
Custom Expressions dialog box, you can select the pre-defined expression
TERR_String
from the
Function list. This expression function invokes the TERR engine to return a vector or a single column data frame of the data type
character
, which is converted to a Spotfire column of the corresponding Spotfire data type String data type.
Argument | Argument description |
---|---|
A TERR script. | The TERR script contains the following.
|
Spotfire column names. | Passed as additional arguments, these are the data column names that
input1 to
inputN represent. All columns must be the same length.
|
Returned by TERR | Converted in Spotfire |
---|---|
A vector or a single column data frame of data type
character . The returned output must be encoded as UTF-8.
|
A column with the same number of rows as the input, and of the data type String. |
TERR_String example
This example data set gives information on the makes of cars taken from the April, 1990 issue of Consumer Reports (pages 235-255). This data set contains 6 columns for 61 cars (rows). You can find the sample data set in
Car data set for Spotfire examples.
Tip: You can
copy (CTRL+C) the contents of the sample data table and paste it (CTRL+V) into
the Spotfire user interface.
In the expression function, create a new column that adds the character string "ish" to the end of each entry from Type.
TERR_String("output <- paste(input1,'ish',sep='')",[Type])
The resulting table in Spotfire shows the following.
Important: Spotfire autocorrects the function case or name to that of built-in Spotfire function names. (For example, TERR contains the function
max
, and Spotfire contains the function
Max
. ) You must overwrite this autocorrection manually to ensure that you use the TERR function case and name in your expression function.
See Embedding the contents of a script in an expression function for a detailed procedure for creating an expression function.
Parent topic: Built-In TERR Expression Functions in Spotfire