Example of a way to let the user select between alternate input tables for a data function.

Example of a way to let the user select between alternate input tables for a data function.

book

Article ID: KB0080952

calendar_today

Updated On:

Products Versions
Spotfire Analyst All supported versions
Spotfire Enterprise Runtime for R All supported versions

Description

This article provides an example of a way to let the user select between alternate input tables for a Spotfire data function.
 

Issue/Introduction

Example of a way to let the user select between alternate input tables for a data function.

Environment

All supported environments

Resolution

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.

 

Attachments

Example of a way to let the user select between alternate input tables for a data function. get_app
Example of a way to let the user select between alternate input tables for a data function. get_app
Example of a way to let the user select between alternate input tables for a data function. get_app