Product: TIBCO Spotfire®
Example of a way to let the user select between alternate input tables for a data function.
This article provides an example of a way to let the user select between alternate input tables for a Spotfire data function.
The example in the attached Spotfire analysis file (filename: "DataFunction - UserSelectableInTable.dxp") shows a way to allow the user to choose the input table for a data function.
The example DXP file's "demo" data function expects an input parameter named 'input', returns an output parameter named 'output', and uses the following TIBCO Enterprise Runtime for R (TERR) script:
#-----
output <-
data.frame(
Vehicle = input$Vehicle,
Abbr = substring(input$Vehicle, first=1, last=3),
WghtDispRatio = input$Weight/input$Disp.,
stringsAsFactors = F )
#-----
The data function uses the following Spotfire expression (in the "Edit > Data Function Properties > Edit Parameters" dialog's "Expression" field) to define its input data table:
$map("[${InputTableName}].$esc($csearch([${InputTableName}],"*"))",",")
That expression uses the "InputTableName" document property, which is linked to a list box in the text area whose two values available for selection are the strings "FuelFrameA" and "FuelFrameB".
The text area also has a button named 'data function "demo"', which refreshes the data function when it is pressed.
The user instructions provided below the list box and the button (in the text area) read as follows:
1. Select the data function's input table (above).
2. Press the button (above) to refresh the data function.
The display below the text box shows Table visualizations for the following three data tables:
FuelFrameA
FuelFrameB
OutputTable
The data function's 'output' object is returned to Spotfire as the data table named "OutputTable".
The display for the "OutputTable" data table changes each time the data function is refreshed with a different input table selected.
Comments
0 comments
Article is closed for comments.