Class

SpotfireDocumentEditor

SpotfireDocumentEditor(serverUrl, documentPath, onDocumentOpenedHandler)

Constructor

new SpotfireDocumentEditor(serverUrl, documentPath, onDocumentOpenedHandler)

Represents the state to be applied to the TIBCO Spotfire® document, using a collection of pages, markings and filters.

Parameters:
Name Type Description
serverUrl String

The TIBCO Spotfire® server URL to be connected to.

documentPath String

The document to be opened. Mandatory to use in a mashup using the TIBCO Spotfire® Web Player. Optional for the TIBCO Spotfire® Analyst.

onDocumentOpenedHandler onDocumentOpenedEventHandler

Handler to be executed on the openedDocument event.

[ err ] Error

The error that may have occurred or undefined.

Methods

addBarChart(barChartDescription)

Adds a Bar Chart to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
barChartDescription Object

The bar chart description. See SpotfireBarChart for details.

Example

Example of a trellised bar chart with multiple scales on the Value axis:

spotfireDocument.editor.addPage({title:'MyPage'}).addBarChart({
    general: {title: 'myBarChart'},
    appearance: {layout: 'sideBySide'},
    trellis: {
        trellisMode: 'Panels',
        panelAxis: { columns: ['CODE'] }
    }
})
.addBarChart({
    general: {title: 'myBarChart'},
    valueAxis: {
        individualScalingMode: 'Trellis',
        ranges: [{
            scale: 'SPB 07552',
            min: 0,
            max: 10
        }]
    }
})
.applyState();

addBoxPlot(boxPlotDescription) → {this}

Adds a Box Plot to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
boxPlotDescription Object

The box plot properties. See SpotfireBoxPlot for details.

this

addColumnMatchings(columnRelations)

Adds a match between two columns from two different data tables.

Parameters:
Name Type Description
columnRelations Array.<SpotfireColumnRelation>

Array of column relation descriptions.

Example
spotfireDocument.editor
    .addColumnMatchings([
        {
            leftColumn: {
                tableName: 'firstDataTable',
                name: 'a column of firstDataTable',
                transformation: SpotfireColumnTransformation.integer
            },
            rightColumn: {
                tableName: 'secondDataTable',
                name: 'a column of secondDataTable',
                transformation: SpotfireColumnTransformation.integer
            }
        }
    ])
    .applyState();

// Same as
const columnRelation = new SpotfireColumnRelation(
  'firstDataTable',
  'a column of firstDataTable',
  'secondDataTable',
  'a column of secondDataTable',
  SpotfireColumnTransformation.integer,
  SpotfireColumnTransformation.integer);
spotfireDocument.editor.addColumnMatchings([columnRelation]);

addColumnRelations(columnRelationsDescription, getMethod, destinationArray)

Adds/replaces a relation between two columns of two data tables. Used to add data table relations and column matchings for adding linked data.

Parameters:
Name Type Description
columnRelationsDescription Array.<Object>

Array of descriptions of the relations between data columns.

[].leftColumn ColumnDescription

The column to match with in the destination data table.

name String

The name of the column.

tableName String

The name of the data table that owns the column.

transformation String

The transformation to apply on the column from SpotfireColumnTransformations.

[].rightColumn ColumnDescription

The column to match with in the source data table.

name String

The name of the column.

tableName String

The name of the data table that owns the column.

transformation String

The transformation to apply on the column from SpotfireColumnTransformations.

getMethod function

The method to use when getting the corresponding relations.

destinationArray Array.<SpotfireColumnRelation>

The array of SpotfireColumnRelation where to push/modify the column relation.

Example
spotfireDocument.editor.loadDataTableFromUrl('oneTable',urlToImport)
.loadDataTableFromUrl('secondTable',urlToImport)
.addColumnRelations([
{
       leftColumn : {
          tableName: 'oneDataTable',
          name: 'Activity',
          transformation: SpotfireColumnTransformations.string
      },
      rightColumn : {
          tableName: 'secondDataTable',
          name: 'Activity',
          transformation: SpotfireColumnTransformations.string
      }
  }
]).applyState()

addColumnsFromUrl(importedDataAsColumnDescription) → {this}

Adds data to be imported as columns in a data table.

Parameters:
Name Type Description
importedDataAsColumnDescription ImportedDataAsColumnDefinition

The definition of the columns to import

urlSource String

The URL of the source containing the columns to be imported.

dataTableTarget String

The name of the data table in which new columns will be imported.

targetIdColumn String

The name of the column in the target data table to use for the matching.

sourceIdColumn String

The name of the column in the source data table to use for the matching.

[ otherColumnsMatching ] Array.<ColumnMatching>

Array of the description of other column matches.

[].targetColumn String

The name of the column in the target data table to use for the matching.

[].sourceColumn String

The name of the column in the source data table to use for the matching.

[ replaceCommonColumns = false ] Boolean

Specifies whether the columns in the target data table should be replaced by the imported columns if they are common. Otherwise, the name of imported columns will be indexed.

columnsToReplace Array.<String>

Columns to be replaced by the imported data.

this

addCombinationChart(combinationChartDescription)

Adds a SpotfireCombinationChart to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
combinationChartDescription Object

The combination chart properties (see SpotfireCombinationChart for details).

addCrossTable(crossTableDescription) → {this}

Adds a SpotfireCrossTable to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
crossTableDescription Object

The cross table properties (see SpotfireCrossTable for details).

this

addCustomScript(customScriptText, [atTheEnd]) → {this}

Adds an IronPython custom script to the SpotfireDocumentEditor, using the TIBCO Spotfire® IronPython API. This script can be executed after the last created element (DataTable, Page, DataVisualization) or at the very end of the script.

NB: in your custom script, if atTheEnd == false (default) you can directly access the latest element created by the editor using this convention:

  • dataviz: the variable containing the last visualization created,
  • pageToModify: the variable containing the last page created,
  • currentDataTable: the variable containing the last data table created.

NBB: if the SpotfireDocumentEditor does not create a data table, a page or a visualization when calling addCustomScript, the script will be executed with this context:

  • dataviz = None
  • pageToModify = Document.ActivePageReference
  • currentDataTable = None
Parameters:
Name Type Default Description
customScriptText String

The custom Iron Python script to execute.

[ atTheEnd = false ] Boolean

Specifies whether the script should be added at the end of the state or not. If true, the script will be executed at the very end of all instructions (Creation of Data Tables, Pages, Visualizations, etc.).

this
Examples

Modify the name of a data table after its creation:

spotfireDocument.editor
     .loadDataTableFromUrl('A New Table', 'https://anURI/aSBDF.sbdf')
     .addCustomScript('currentDataTable.Name = "My New Table (modified using a custom script)"')
     .applyState()

Modify the name of a line chart using a custom script and then add a bar chart using the API:

spotfireDocument.editor.addLineChart({ general: { title: "MyLineChart"}});
var currentDataviz = spotfireDocument.editor.lastElementCreated;
currentDataviz.addCustomScript('dataviz.Title = "My Line Chart (modified using a custom script)"');
spotfireDocument.editor.addBarChart().applyState()

Modify the name of a page using a custom script after its creation:

spotfireDocument.editor
     .addPage('MyLastPage')
     .addCustomScript('pageToModify.Title = "My Last Page (modified using a custom script)"')
     .applyState()

Modify the name of the current page using a custom script:

spotfireDocument.editor
     .addCustomScript('pageToModify.Title = "My Last Page (modified using a custom script)"')
     .applyState()

Modify the name of the page named 'MyPage' using a custom script added at the end of the state:

spotfireDocument.editor
     .addCustomScript('for page in Document.Pages:\n' +
                       '    if(page.Title == "MyPage"):\n' +
                       '        pageToModify = page\n' +
                       '    break\n' +
                       'pageToModify.Title = "My Last Page (modified using a custom script)"', true)
     .addPage('MyPage')
     .applyState()

addDataTable(dataTableDescription) → {this}

Adds a data table to the current document. If the specified Data Table exists (Data Table with the same name), it will be updated with the new description.

Parameters:
Name Type Description
dataTableDescription DataTableDescription

The description of the data table.

name String

The name of the data table.

fromUrl String

The URL of the source.

fromInformationLink String

The information link to be used to load the data table.

informationLinkParameters String

The parameters of the information link.

addedColumnsDefinitions Array.<AddedColumnsDefinition>

Array of columns to add (calculated column, etc ...).

[].type SpotfireDataColumnsTypes  {Enum} 

The type of the column to add from SpotfireDataColumnsTypes.

Enum options: calculatedDataColumn
[].name String

The name of the column to add.

[].expression String

The expression to be used to calculate the column.

importedDataAsColumns Array.<ImportedDataAsColumnDefinition>

Array of columns to import.

[].urlSource String

The URL of the source containing the columns to be imported.

[].dataTableTarget String

The name of the data table in which new columns will be imported.

[].targetIdColumn String

The name of the column in the target data table to use for the matching.

[].sourceIdColumn String

The name of the column in the source data table to use for the matching.

[ [].otherColumnsMatching ] Array.<ColumnMatching>

Array of the description of other column matches.

[].targetColumn String

The name of the column in the target data table to use for the matching.

[].sourceColumn String

The name of the column in the source data table to use for the matching.

[ [].replaceCommonColumns = false ] Boolean

Specifies whether the columns in the target data table should be replaced by the imported columns if they are common. Otherwise, the name of imported columns will be indexed.

[].columnsToReplace Array.<String>

Columns to be replaced by the imported data.

importedDataAsRows Array.<ImportedDataAsRowDefinition>

Array of rows to import.

[].urlSource String

The URL of the source containing the columns to be imported.

[].dataTableTarget String

The name of the data table in which new rows will be imported.

[ [].ignoredColumn ] Array.<String>

The list of columns to be ignored during importation.

[ [].rowSourceColumn ] String

The column that identifies the origin of the row.

[ [].rowSourceValue ] String

The value that identifies the source of the row from the imported source.

[ [].originalRowSourceValue ] String

The value that identifies the source of the row from the target data table.

[ [].mappings ] Array.<ColumnMatching>

The list of columns to map between imported rows to existing rows. If not set, all common columns are merged. If set, common columns will be created with an indexed name.

[].targetColumn String

The name of the column in the target data table to use for the matching.

[].sourceColumn String

The name of the column in the source data table to use for the matching.

properties Array.<DataTablePropertyDefinition>

Array of data table properties.

[].name String
[].value string | boolean | number
this

addDataTableColumns(dataTableName, addedColumnsDefinitions) → {this}

Adds columns to a data table.

Parameters:
Name Type Description
dataTableName String

The name of the data table.

addedColumnsDefinitions Array.<AddedColumnsDefinition>

The definition of columns to be added.

[].type SpotfireDataColumnsTypes  {Enum} 

The type of the column to add from SpotfireDataColumnsTypes.

Enum options: calculatedDataColumn
[].name String

The name of the column to add.

[].expression String

The expression to be used to calculate the column.

this

addDataTableProperty(dataTableName, dataTablePropertyName, dataTablePropertyValue)

Adds/updates a property in the specified data table.

Parameters:
Name Type Description
dataTableName String

The name of the data table to be updated.

dataTablePropertyName String

The name of the data table property to be added/updated.

dataTablePropertyValue String | Boolean | Number

The value of the data table property to be added/updated.

addDataTableRelations(dataTableRelations) → {this}

Adds a relation between two columns from two different data tables.

Parameters:
Name Type Description
dataTableRelations Array.<SpotfireColumnRelation>

Array of column relation descriptions.

this
Example
spotfireDocument.editor
    .addDataTableRelations([
        {
            leftColumn: {
                tableName: 'firstDataTable',
                name: 'a column of firstDataTable',
                transformation: 'Integer(Value)'
            },
            rightColumn: {
                tableName: 'secondDataTable',
                name: 'a column of secondDataTable',
                transformation: 'Integer(Value)'
            }
        }
    ])
    .applyState();

addFilter(filterDescription)

Adds a filter in the current state to be applied to the current document.

Parameters:
Name Type Description
filterDescription filterDescription

The description of the filter.

type SpotfireFiltersTypes  {Enum} 

The type of the filter.

Enum options: rangeFilter, itemFilter, radioButtonFilter, checkBoxFilter, textFilter, listBoxFilter
column String

The name of the column on which the filter is applied.

[ filteringScheme ] String

The name of the filtering scheme in which the filter is added. If not specified, the active filtering scheme will be used.

[ dataTable ] String

The name of the data table on which the filter is applied. If not specified, the active data table will be used.

[ reset = false ] Boolean

Indicates whether the filter should be reset or not.

value Object

The value to be set. The format of this parameter depends on the SpotfireFiltersTypes.

Example
spotfireDocument.editor.addFilter({
    type: "Range Filter",
    column: "ALogP",
    value: {
        min: "1",
        max: "5"
    },
    valueDataRange: {
        min: "0",
        max: "8"
    },
    includeEmpty: true
}).applyState();

addFiltering(filteringName)

Adds a filtering scheme in the current state to be applied to the current document.

Parameters:
Name Type Description
filteringName string

The name of the filtering scheme to be added.

addFilterings(arrayOfFilteringNames)

Adds one or more filtering schemes in the current state to be applied to the current document.

Parameters:
Name Type Description
arrayOfFilteringNames Array.<string>

The array of filtering schemes to be added.

addGraphicalTable(graphicalTableDescription) → {this}

Adds a SpotfireGraphicalTable to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
graphicalTableDescription Object

The graphical table properties (see SpotfireGraphicalTable for details).

this

addHeatMap(heatMapDescription) → {this}

Adds a SpotfireHeatMap to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
heatMapDescription Object

The heat map properties (see SpotfireHeatMap for details).

this

addKPIChart(kpiChartDescription) → {this}

Adds a SpotfireKPIChart to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
kpiChartDescription Object

The KPI chart properties (see SpotfireKPIChart for details).

this

addLineChart(lineChartDescription) → {this}

Adds a SpotfireLineChart to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
lineChartDescription Object

The line chart properties (see SpotfireLineChart for details).

this

addMapChart(mapChartDescription) → {this}

Adds a SpotfireMapChart to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
mapChartDescription Object

The map chart properties (see SpotfireMapChart for details).

this

addMarking(markingDescription)

Adds or updates a marking in the current Spotfire document.

Parameters:
Name Type Description
markingDescription MarkingDescription

Description of the marking to be created/modified.

name String

The name of the marking.

[ color ] String | MarkingColor

The color of the marking either as a MarkingColor object or as an hexadecimal code.

[ a ] number

The alpha component of the color. Must be between 0 and 255.

[ r ] number

The red component of the color. Must be between 0 and 255.

[ g ] number

The green component of the color. Must be between 0 and 255.

[ b ] number

The blue component of the color. Must be between 0 and 255.

addMarkings(arrayOfMarkingDescription)

Adds or updates one or more markings to the current state to be applied to the current document.

Parameters:
Name Type Description
arrayOfMarkingDescription Array.<MarkingDescription>

Array of marking descriptions.

[].name String

The name of the marking.

[ [].color ] String | MarkingColor

The color of the marking either as a MarkingColor object or as an hexadecimal code.

[ a ] number

The alpha component of the color. Must be between 0 and 255.

[ r ] number

The red component of the color. Must be between 0 and 255.

[ g ] number

The green component of the color. Must be between 0 and 255.

[ b ] number

The blue component of the color. Must be between 0 and 255.

addPage(pageDescription) → {this}

Adds a page to the current state to be applied to the current Spotfire document.

Parameters:
Name Type Description
pageDescription String | PageDescription

The title or the complete description of the page to be added.

title String

The title of the page.

[ tileMode = Vertically ] String

The tile mode that defines the layout of the page (Vertically|Horizontally).

[ showWebPanel = true ] Boolean

Specifies whether or not the Web Panel should be visible or not.

this

addParallelCoordinatePlot(parallelCoordinatePlotDescription) → {this}

Adds a SpotfireParallelCoordinatePlot to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
parallelCoordinatePlotDescription Object

The parallel coordinate plot properties (see SpotfireParallelCoordinatePlot for details).

this

addPieChart(pieChartDescription) → {this}

Adds a SpotfirePieChart to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
pieChartDescription Object

The pie chart properties (see SpotfirePieChart for details).

this

addRowsFromUrl(importedDataAsRowsDescription)

Add data from url as rows in a data table.

Parameters:
Name Type Description
importedDataAsRowsDescription ImportedDataAsRowDefinition
urlSource String

The URL of the source containing the columns to be imported.

dataTableTarget String

The name of the data table in which new rows will be imported.

[ ignoredColumn ] Array.<String>

The list of columns to be ignored during importation.

[ rowSourceColumn ] String

The column that identifies the origin of the row.

[ rowSourceValue ] String

The value that identifies the source of the row from the imported source.

[ originalRowSourceValue ] String

The value that identifies the source of the row from the target data table.

[ mappings ] Array.<ColumnMatching>

The list of columns to map between imported rows to existing rows. If not set, all common columns are merged. If set, common columns will be created with an indexed name.

[].targetColumn String

The name of the column in the target data table to use for the matching.

[].sourceColumn String

The name of the column in the source data table to use for the matching.

addScatterPlot(scatterPlotDescription) → {this}

Adds a SpotfireScatterPlot to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
scatterPlotDescription Object

The scatter plot properties (see SpotfireScatterPlot for details).

this

addScatterPlot3D(scatterPlot3DDescription) → {this}

Adds a SpotfireScatterPlot3D to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
scatterPlot3DDescription Object

The scatter plot 3D properties (see SpotfireScatterPlot3D for details).

this

addSummaryTable(summaryTableDescription) → {this}

Adds a SpotfireSummaryTable to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
summaryTableDescription Object

The summary table properties (see SpotfireSummaryTable for details).

this

addTable(tableDescription) → {this}

Adds a SpotfireTable to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
tableDescription Object

The table plot properties (see SpotfireTable for details).

this

addTreemap(treemapDescription) → {this}

Adds a SpotfireTreemap to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
treemapDescription Object

The treemap properties (see SpotfireTreemap for details).

this

addWaterfallChart(waterfallDescription) → {this}

Adds a SpotfireWaterfallChart to the current state to be applied on the current Spotfire document.

Parameters:
Name Type Description
waterfallDescription Object

The waterfall chart properties (see SpotfireWaterfallChart for details).

this

getColumnMatchingRelation(leftColumn, rightColumn) → {Object|null}

Get the SpotfireColumnRelation from the columnMatchings collection having the same name for left and right column than the arg specified

Parameters:
Name Type Description
leftColumn ColumnDescription

the left column description for the column relation searched

name String

The name of the column.

tableName String

The name of the data table that owns the column.

transformation String

The transformation to apply on the column from SpotfireColumnTransformations.

rightColumn ColumnDescription

the right column description for the column relation searched

name String

The name of the column.

tableName String

The name of the data table that owns the column.

transformation String

The transformation to apply on the column from SpotfireColumnTransformations.

Object | null

getColumnRelation(leftColumn, rightColumn, columnRelationCollection) → {Object|null}

Get the corresponding column relation from the specified SpotfireColumnRelation collections having the same name for left and right column than the arg specified

Parameters:
Name Type Description
leftColumn ColumnDescription

the left column description for the column relation searched

name String

The name of the column.

tableName String

The name of the data table that owns the column.

transformation String

The transformation to apply on the column from SpotfireColumnTransformations.

rightColumn ColumnDescription

the right column description for the column relation searched

name String

The name of the column.

tableName String

The name of the data table that owns the column.

transformation String

The transformation to apply on the column from SpotfireColumnTransformations.

columnRelationCollection Array.<Object>

the SpotfireColumnRelation collection you are searching in

Object | null

getDataTable(dataTableName) → {SpotfireDataTable|null}

Returns the data table with the given name if it exists.

Parameters:
Name Type Description
dataTableName String

The name of the data table.

SpotfireDataTable | null

getDataTableRelation(leftColumn, rightColumn)

Get the SpotfireColumnRelation from the dataTableRelations collection having the same name for left and right column than the arg specified

Parameters:
Name Type Description
leftColumn ColumnDescription

the left column description for the column relation searched

name String

The name of the column.

tableName String

The name of the data table that owns the column.

transformation String

The transformation to apply on the column from SpotfireColumnTransformations.

rightColumn ColumnDescription

the right column description for the column relation searched

name String

The name of the column.

tableName String

The name of the data table that owns the column.

transformation String

The transformation to apply on the column from SpotfireColumnTransformations.

getMarking(markingDescription) → {MarkingDescription|null}

Gets the marking in the current state to be applied having the same name than the MarkingDescription provided.

Parameters:
Name Type Description
markingDescription MarkingDescription

The marking description having the provided name.

name String

The name of the marking.

[ color ] String | MarkingColor

The color of the marking either as a MarkingColor object or as an hexadecimal code.

[ a ] number

The alpha component of the color. Must be between 0 and 255.

[ r ] number

The red component of the color. Must be between 0 and 255.

[ g ] number

The green component of the color. Must be between 0 and 255.

[ b ] number

The blue component of the color. Must be between 0 and 255.

MarkingDescription | null

getPage(pageDescription) → {SpotfirePage|undefined}

Gets the SpotfirePage having the same title than the provided pageDescription from the current state to be applied to the current SpotfireDocument.

Parameters:
Name Type Description
pageDescription String | PageDescription

The title or page description.

title String

The title of the page.

[ tileMode = Vertically ] String

The tile mode that defines the layout of the page (Vertically|Horizontally).

[ showWebPanel = true ] Boolean

Specifies whether or not the Web Panel should be visible or not.

SpotfirePage | undefined

getPageByVisualDescription(visualDescription) → {SpotfirePage|undefined}

Get the SpotfirePage for the corresponding visualDescription (see SpotfireVisualization arg)

Parameters:
Name Type Description
visualDescription Object

the visual description with a pageTitle property

SpotfirePage | undefined

loadDataTableFromInformationLink(dataTableName, informationLink, informationLinkParameters, [addedColumnsDefinitions]) → {this}

Loads a data table from a TIBCO Spotfire® information link.

Parameters:
Name Type Description
dataTableName String

The name of the data table.

informationLink String

The complete path to the information link to be used.

informationLinkParameters Array.<InformationLinkParameter>

The parameters of the information link.

[].name String

The name of the parameter.

[].values Array.<Object>

The array of values to be applied for the parameter.

[ addedColumnsDefinitions ] Array.<AddedColumnsDefinition>

Array of definitions of the columns to be added. Only calculated columns can be added for now.

[].type SpotfireDataColumnsTypes  {Enum} 

The type of the column to add from SpotfireDataColumnsTypes.

Enum options: calculatedDataColumn
[].name String

The name of the column to add.

[].expression String

The expression to be used to calculate the column.

this
Examples
spotfireDocument.editor.loadDataTableFromInformationLink('dataTable', '/path/to/the/information_link', null, null).applyState()
spotfireDocument.editor.loadDataTableFromInformationLink('dataTable', '/path/to/the/information_link', [
 {
     name: "a_string_parameter",
     values: "Europe"
 }, {
     name: "an_integer_parameter_with_multiple_values",
     values: [2, 4]
 }],
 null).applyStateAsync(true)

loadDataTableFromUrl(dataTableName, url, [addedColumnsDefinitions]) → {this}

Loads a data table from a URL.

Parameters:
Name Type Description
dataTableName String

The name of the data table.

url String

The URL of the source containing the data table.

[ addedColumnsDefinitions ] Array.<AddedColumnsDefinition>

Array of definitions of the columns to be added. Only calculated columns can be added for now.

[].type SpotfireDataColumnsTypes  {Enum} 

The type of the column to add from SpotfireDataColumnsTypes.

Enum options: calculatedDataColumn
[].name String

The name of the column to add.

[].expression String

The expression to be used to calculate the column.

this
Example
spotfireDocument.editor.loadDataTableFromUrl('dummyTable', 'http://dummySource/url', [
 {
     type: SpotfireDataColumnsTypes.calculatedDataColumn,
     name: 'MyCalculatedColumn1',
     expression: 'SUM([Col1])'
 },
 {
     type: SpotfireDataColumnsTypes.calculatedDataColumn,
     name: 'MyCalculatedColumn2',
     expression: 'AVG([Col2])'
 }
 ]).applyStateAsync(true)

removeRowsFromDataTable(dataTable)

Removes all rows from a data table. This action will always be executed after all other actions on the last created data table of the state.

Parameters:
Name Type Description
dataTable String

The name of the data table in which all rows are to be removed. If not specified, the current data table of the state is used.

resetFilter(filterDescription)

Resets a filter in the current state to be applied to the current document.

Parameters:
Name Type Description
filterDescription filterDescription

The description of the filter.

type SpotfireFiltersTypes  {Enum} 

The type of the filter.

Enum options: rangeFilter, itemFilter, radioButtonFilter, checkBoxFilter, textFilter, listBoxFilter
column String

The name of the column on which the filter is applied.

[ filteringScheme ] String

The name of the filtering scheme in which the filter is added. If not specified, the active filtering scheme will be used.

[ dataTable ] String

The name of the data table on which the filter is applied. If not specified, the active data table will be used.

[ reset = false ] Boolean

Indicates whether the filter should be reset or not.

Example
spotfireDocument.editor.resetFilter({
    column: "ALogP"
}).applyState();

setFilterVisible(filterHandlerDescription)

Shows or hides a filter in the current state to be applied to the current document.

Parameters:
Name Type Description
filterHandlerDescription filterHandlerDescription

The description of the filter handler containing the filter to be displayed or hidden.

column String

The name of the column on which the filter is applied.

[ visible = true ] Boolean

Indicates whether the filter should be visible or not in the filter handler.

[ page ] String

The name of the page containing the filter handler. If not specified, the active page will be used.

[ dataTable ] String

The name of the data table on which the filter is applied. If not specified, the active data table will be used.