Data Table Manipulation

Source:

Methods

addColumnsFromDataTable(sourcedatatablename, destinationdatatablename, js_destinationmatchCol, js_sourcematchCol, js_deleteCols, js_delimiter)

Adds TIBCO Spotfire Data Columns from an existing TIBCO Spotfire Data Table.
Parameters:
Name Type Description
sourcedatatablename string The name of the source data table.
destinationdatatablename string The name of the destination data table.
js_destinationmatchCol string The name of the matching identifier data column in destination data table.
js_sourcematchCol string The name of the matching identifier data column in source data table.
js_deleteCols string The list of data columns to replace or to add. The names are sperated by a delimiter (defined in js_delimiter parameter).
js_delimiter string The delimiter of the columns names list.
Source:
Throws:
  • If the source data table does not exist in the document.
  • If the destination data table does not exist in the document.
  • If the column does not exist in the source data table .
  • If the column does not exist in the destination data table.

addDataFromDataTable(sourcedatatablename, destinationdatatablename, js_matchCol_source, js_matchCol_destination, js_deleteCols, js_delimiter)

Adds a TIBCO Spotfire Data Column from an existing TIBCO Spotfire Data Table.
Parameters:
Name Type Description
sourcedatatablename string The name of the source data table. If empty, the Spotfire active data table is used.
destinationdatatablename string The name of the destination data table.
js_matchCol_source string The name of the matching identifier data column in the source data table.
js_matchCol_destination string The name of the matching identifier data column in the destination data table.
js_deleteCols string The list of data columns to replace or to add. The names are sperated by a delimiter (defined in js_delimiter parameter).
js_delimiter string The delimiter of the columns names list.
Source:
Throws:
  • If the source data table does not exist in the Document.
  • If the destination data table does not exist in the Document.
  • If the matching data column cannot be getted from the source data table.
  • If the matching data column cannot be getted from the destination data table.

addDataFromFile(js_url, datatablename, js_matchCol, js_deleteCols, js_delimiter)

Adds a TIBCO Spotfire Data columns from an url to a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
js_url string The url of the file to load.
datatablename string The name of the data table to which the columns are added. If empty, the Spotfire active data table is used.
js_matchCol string The name of the matching identifier data column.
js_deleteCols string The list of data columns to replace or to add. The names are separated by a delimiter (defined in js_delimiter parameter).
js_delimiter string The delimiter of the columns names list.
Source:
Throws:
  • If the data table does not exist in the document.
  • If data cannot be getted from the file.
  • If the matching data column cannot be getted from the data table.
  • If the matching data column cannot be getted from the file.
Adds a TIBCO Spotfire Data columns from an url to a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatablename string The name of the data table to which the columns are added. If empty, the Spotfire active data table is used.
informationlinkname string The name of the information link to load. If the library is specified, the path must contain "/".
js_matchCol string The name of the matching identifier data column.
js_deleteCols string The list of data columns to replace or to add. The names are separated by a delimiter (defined in js_delimiter parameter).
js_delimiter string The delimiter of the columns names list.
parameters string The parameters string (i.e. ParameterName=value; for a single string value, or ParameterName={value1,value2}; for an array, or ParameterName=0; for a numeric value, or ParameterName1=value1;ParameterName2={value2,value3}; for several parameters). The characters "=", ";", "{", "}", "," have to be escaped by "\\" in a parameter name or in a value.
Source:
Throws:
  • If the data table does not exist in the document.
  • If the information link is not found in the library.
  • If the matching data column cannot be getted from the data table.
  • If the matching data column cannot be getted from the information link.
Example
addDataFromInformationLink("Pipeline Pilot Data 1", "/myLibrary/myDirectory/myInformationLink", "IDNUMBER", "col1;col2", ";", "id=idnumber;");
 addDataFromInformationLink("Pipeline Pilot Data 1", "/myLibrary/myDirectory/myInformationLink", "IDNUMBER", "col1;col2", ";",
     "id=idnumber;val=a\\,value\\{with\\=escaped\\}characters\\;;");
Loads a TIBCO Spotfire Data table from an information link.
Parameters:
Name Type Description
informationlinkname string The name of the information link to load. If the library is specified, the path must contain "/".
datatablename string The name of the data table to create.
parameters string The parameters string (i.e. "ParameterName=value;" for a single string value, or "ParameterName={value1,value2};" for an array, or "ParameterName=0;" for a numeric value, or "ParameterName1=value1;ParameterName2={value2,value3};" for several parameters). The characters "=", ";", "{", "}", "," have to be escaped by "\\" in a parameter name or in a value.
keepexistingdatatable string If true and "datatablename" already exists in the document, the new datatable will have an indexed name. If false, the existing "datatablename" will be replaced by this one.
Source:
Throws:
If the information link cannot be found.
Example
addDataTableFromInformationLink("/myLibrary/myDirectory/myInformationLink", "Pipeline Pilot Data 1", "id=idnumber;", "true");
 addDataTableFromInformationLink("/myLibrary/myDirectory/myInformationLink", "Pipeline Pilot Data 1",
     "id=idnumber;val=a\\,value\\{with\\=escaped\\}characters\\;;", "true");

addRowsFromDataTable(sourcedatatablename, destinationdatatablename)

Adds TIBCO Spotfire Data Rows from an existing TIBCO Spotfire Data Table.
Parameters:
Name Type Description
sourcedatatablename string The name of the source data table.
destinationdatatablename string The name of the destination data table. If empty, the Spotfire active data table is used.
Source:
Throws:
If the data table does not exist in the document.

addRowsFromFile(js_url, datatablename)

Adds TIBCO Spotfire Data Rows from a URL to a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
js_url string The url of the file to load.
datatablename string The name of the data table to which the columns are added. If empty, the Spotfire active data table is used.
Source:
Throws:
If data cannot be getted from the URL.
Adds a TIBCO Spotfire Data rows from an information link to a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatablename string The name of the data table to which the rows are added. If empty, the Spotfire active data table is used.
informationlinkname string The name of the Information Link.
parameters string The parameters string (i.e. ParameterName=value; for a single string value, or ParameterName={value1,value2}; for an array, or ParameterName=0; for a numeric value, or ParameterName1=value1;ParameterName2={value2,value3}; for several parameters). The characters "=", ";", "{", "}", "," have to be escaped by "\\" in a parameter name or in a value.
Source:
Throws:
If the information link does not exist in the library.
Examples
addRowsFromInformationLink("/myLibrary/myDirectory/myInformationLink", "Pipeline Pilot Data 1", "id=idnumber;");
addRowsFromInformationLink("/myLibrary/myDirectory/myInformationLink", "Pipeline Pilot Data 1", "id=idnumber;val=a\\,value\\{with\\=escaped\\}characters\\;;");

changeDataTable(id, datatable)

Changes the TIBCO Spotfire Data Table of a visualization.
Parameters:
Name Type Description
id string The id of the visualization. Unique in the current TIBCO Spotfire Document.
datatable string The name of TIBCO Spotfire Data table to set.
Source:

changeDataTableForAll(datatable)

Changes the TIBCO Spotfire Data Table of all visualizations.
Parameters:
Name Type Description
datatable string The name of TIBCO Spotfire Data table to set.
Source:

createDataRelation(lefttablename, righttablename, leftexpression, rightexpression)

Creates a data relation including two TIBCO Spotfire Data Tables. If it already exists a relation between those two TIBCO Spotfire Data Tables, the new relation will overwrite the old one.
Parameters:
Name Type Description
lefttablename string The name of the left data table.
righttablename string The name of the right data table.
leftexpression string Escaped column of left data table to use to create the relation. The left data table must be re-precised (see the following example).
rightexpression string Escaped column of right data table to use to create the relation. The right data table must be re-precised (see the following example).
Source:
Throws:
  • If the left data table does not exist in the document.
  • If the right data table does not exist in the document.
Example
createDataRelation('rightDT', 'leftDT', '[rightDT].[columnX]', '[leftDT].[columnY]');

deleteAllDataTables()

Removes all TIBCO Spotfire Data Tables from the current TIBCO Spotfire Document.
Source:
Example
deleteAllDataTables();

deleteAllRows(datatable)

Delete all rows from a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatable string The name of the TIBCO Spotfire Data table to clear. If empty, the Spotfire active data table is used.
Source:
Throws:
If the data table does not exist in the document.

deleteColumn(datatablename, js_deleteCol)

Removes a TIBCO Spotfire Data column from a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatablename string The name of the data table from which the column is deleted.
js_deleteCol string The name of the data column to delete.
Source:
Throws:
If the data table does not exist in the Document.

deleteColumns(datatablename, js_deleteCols, js_delimiter)

Removes TIBCO Spotfire Data columns from a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatablename string The name of the data table from which the column is deleted. If empty, the Spotfire active data table is used.
js_deleteCols string The list of the data columns to delete. The columns names are sperated by a delimiter (defined in js_delimiter parameter).
js_delimiter string The delimiter of the columns names list.
Source:
Throws:
If the data table does not exist in the Document.

deleteDataTables(datatables)

Removes TIBCO Spotfire Data Tables from the current TIBCO Spotfire Document. If one of datatables to remove is implicated into a relation at the left position and the right datatable of the relation is not in the list, no datatable is removed and an error message is displayed.
Parameters:
Name Type Description
datatables string The list of data tables names to deleted, separated by a comma.
Source:
Throws:
If a data table to remove is implicated in a relation on the left position.
Example
deleteDataTables("Molecules", "Clusters");

deleteRows(datatablename, columnname, values, delimiter)

Deletes TIBCO Spotfire Data Rows from an existing TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatablename string The name of the data table. If empty, the Spotfire active data table is used.
columnname string The name of the column containing values.
values string List of values indentifying rows to delete seperated by the delimiter.
delimiter string The values list separator.
Source:
Throws:
  • If the data table does not exist in the document.
  • If the column does not exist in the data table.

exportAllData(datatablename, folderpath, filename, fileformat, columns, numRows)

Export All data of a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatablename string The name of data table to export. If empty, the Spotfire active data table is used.
folderpath string The UNC where data will be exported into.
filename string The name of export file.
fileformat string The format of the export format.
columns string The name of the columns to export separated by comma(,).
numRows string The number of rows that will be exported.
Source:
Throws:
  • If the data table does not exist in the document.
  • If the folder cannot be reached.
  • If the columns does not exist in the data table.
Example
exportAllData("Pipeline Pilot Data 1", "c:\\temp", "Pipeline_Pilot_Data_1", "STDF","", "10");

getActiveDataTable() → {string}

Gets the active TIBCO Spotfire Data Table name.
Source:
Returns:
The name of the active TIBCO Spotfire Data Table.
Type
string

getColumns(datatablename, delimiter) → {string}

Returns the columns names of a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatablename string The name of data table.
delimiter string The delimiter of the returned list of columns names.
Source:
Returns:
The list of data columns names.
Type
string
Throws:
If the data table does not exist in the document.

getDataTableData(datatablename, markingname, fromrowindex, torowindex, columns, js_delimiter) → {string}

Get data from a TIBCO Spotfire Data Table.
Parameters:
Name Type Description
datatablename string The name of the data table. If empty, the Spotfire active data table is used.
markingname string (optional) The name of the marking.
fromrowindex integer (optional) The first row index of the data range.
torowindex integer (optional) The last row index of the data range.
columns object (optional) The name of the columns to get from data table. It can be a js array or just an string separated by js_delimiter.
js_delimiter string (optional) The delimiter of the columns names list.
Source:
Returns:
data in STDF format.
Type
string
Throws:
  • If the data table does not exist in the document.
  • If the marking does not exist in the document.
  • If the range of rows is not valid.

getDataTables(delimiter) → {string}

Returns the TIBCO Spotfire Data Tables list of the current TIBCO Spotfire document.
Parameters:
Name Type Description
delimiter string The delimiter of the returned list of data tables names.
Source:
Returns:
The list of data tables names.
Type
string

getDefaultDataTable() → {string}

Gets the default TIBCO Spotfire Data Table name.
Source:
Returns:
The name of the default TIBCO Spotfire Data Table.
Type
string

getIdColumn() → {string}

Gets the name of the id column of the active TIBCO Spotfire Data Table.
Source:
Returns:
The name of the id column of the active TIBCO Spotfire Data Table.
Type
string

getRowIndexOf(datatablename, columnname, value) → {string}

Returns the first TIBCO Spotfire Data record row index.
Parameters:
Name Type Description
datatablename string The name of the data table.
columnname string The name of the column which holds the value.
value string The reached value.
Source:
Returns:
The index of row holding the value, -1 if not found.
Type
string
Throws:
  • If the data table does not exist in the document.
  • If the value does not exist in the column.

getValueAt(datatablename, columnname, rowindex) → {string}

Returns the TIBCO Spotfire Data record value at a row index.
Parameters:
Name Type Description
datatablename string The name of the data table.
columnname string The name of the column which holds the value.
rowindex string The index of the row holding the value.
Source:
Returns:
The value at the index.
Type
string
Throws:
  • If the data table does not exist in the document.
  • If the column does not exist in the data table.
  • If the row index does not exist in the data table.

loadDataUrl(js_url, datatablename, keepexistingdatatable)

Loads a TIBCO Spotfire Data table from an url.
Parameters:
Name Type Description
js_url string The url of the file to load.
datatablename string The name of the data table to create.
keepexistingdatatable string If true and "datatablename" already exists in the document, the new datatable will have an indexed name. If false, the existing "datatablename" will be replaced by this one.
Source:
Throws:
If the data table name is null or empty.

refreshAllDataTables()

Refresh all Data Tables on the current Document.
Source:

removeAllDataTableRelations()

Removes all relations between Data Tables from the current TIBCO Spotfire Document.
Source:
Example
removeAllDataTableRelations();

removeDataTableRelations(datatables)

Removes relations between Data Tables from the current TIBCO Spotfire Document.
Parameters:
Name Type Description
datatables string The list of data tables names implicated in relations to remove, separated by a comma.
Source:
Example
removeDataTableRelations("Molecules");

renameColumn(datatablename, js_oldCol, js_newCol)

Renames a TIBCO Spotfire Data column from a TIBCO Spotfire Data Table. If the new name is already used in the data table, it is indexed.
Parameters:
Name Type Description
datatablename string The name of the data table from which the column is renamed. If empty, the Spotfire active data table is used.
js_oldCol string The old name of the data column to rename.
js_newCol string The new name of the data column to rename.
Source:
Throws:
If the data table does not exist in the Document.

renameDataTable(Name, Name)

Renames a Data Table.
Parameters:
Name Type Description
Name string of the Data Table before renaming.
Name string of the Data Table after renaming.
Source:
Throws:
If the data table to rename does not exist in the document.
Example
renameDataTable("myDataTable", "myRenamedDataTable");

setcolumnrenderer(id, column, renderer)

Sets the renderer of a TIBCO Spotfire Data Table column.
Parameters:
Name Type Description
id string The id of the visualization. Unique in the current TIBCO Spotfire Document.
column string The name of the Data Table column.
renderer integer The id of the built-in renderer : 0 = BitmapRenderer, 1 = DefaultRenderer, 2 = GeometryRenderer, 3 = ImageFromUrlRenderer, 4 = LinkRenderer, 5 = VirtualValueRenderer.
Source:

setDefaultDataTable(datatableName)

Sets Data Table as default in the TIBCO Spotfire Document.
Parameters:
Name Type Description
datatableName string Name of the Data Table to set as default.
Source:
Throws:
If the data table does not exist in the document.

setIdColumn(columnname)

Sets the name of the id column of the active TIBCO Spotfire Data Table.
Parameters:
Name Type Description
columnname string The name of the id column of the active TIBCO Spotfire Data Table to set.
Source:

uploadAllData(datatablename, urlServerRoot, sessionID, destinationpath, filename, fileformat, columns)

Upload All data of a Tibco Spotfire Data Table to Pipeline Pilot.
Parameters:
Name Type Description
datatablename string The name of data table to upload. If empty, the Spotfire active data table is used.
urlServerRoot string The root URL of the Pipeline Pilot Server.
sessionID string The Pipeline Pilot session ID.
destinationpath string The destination path where data will be exported into.
filename string The name of uploaded file.
fileformat string The format of the uploaded file.
columns string The name of the columns to upload separated by comma(,).
Source:
Throws:
  • If the data table does not exist in the document.
  • If the columns does not exist in the data table.
Example
uploadAllData("Pipeline Pilot Data 1","" ,"","/apps/discngine/", "Pipeline_Pilot_Data_1", "SBDF");