Retrieve marked values from In-Database data table in TIBCO Spotfire Analyst

Retrieve marked values from In-Database data table in TIBCO Spotfire Analyst

book

Article ID: KB0076878

calendar_today

Updated On:

Products Versions
Spotfire Analyst All Versions

Description

Currently it is not possible to retrieve the marked values from an In-Database data table using IronPython and/or Javascript API or Data Functions (TERR).
You may get the following error when trying to read the marked values using Javascript API
ErrorInternal: Could not find method '_InternalFormat'.
When trying to read marked data using Iron Python API, no data is retrieved in "markedselection = markings.GetSelection(dataTable)" 
Data functions execution using R/TERR is only supported for imported data tables (In-Memory tables) not in-Database tables

Issue/Introduction

This article details about how to retrieve marked values of an In-Database data table

Resolution

Marked values can be read only when data table is imported in TIBCO Spotfire Analyst. 
a) You can use either of the options to import data table:
  1. Import the In-Db data table. See "Adding Data Tables" for more details
  2. Keep the current data table In-DB and add an imported On-Demand data table which is loaded based on the marking in the external data table. See "Data on demand" for more details
b) Then the marked values could be read either using IronPython API, JavaScript API or Data Functions
  1. Use spotfire.webPlayer.DataColumn.getDistinctValues in the JavaScript API like below
    webPlayer.analysisDocument.data.getDataTable("onDemandTableName",
               function(dataTable)
               {
               	dataTable.getDataColumn(String(columnName),
    function(dataColumn)
    {
    dataColumn.getDistinctValues(0, 10,
    function(distinctValues)
    {
    alert(distinctValues.count);
    });
    });
    });
  2. Use Iron python API to retrieve marked values from the imported data table. See "How to retrieve data marking selection using IronPython in TIBCO Spotfire" for more details
  3. Data function can be used to retrieve marked values in document property. See "How to execute an IronPython script on Filter or Marking change" for more details. Attached is MarkedValueDataFunction.dxp for reference. The TERR script will be:
    output <- input
    where:
    • input parameter is of column type pointing to column in data table whose marked values need to be retrieved
    • output parameter is of value type pointing to document property in which values need to be stored

Additional Information

Doc: Adding Data Tables Doc: Data on Demand API: Spotfire Iron Python 7.11 API Wiki: How to retrieve data marking selection using IronPython in TIBCO Spotfire KB: How to execute an IronPython script on Filter or Marking change

Attachments

Retrieve marked values from In-Database data table in TIBCO Spotfire Analyst get_app