Constructor
new SpotfireDocument(serverUrlOrDocumentParametersObject, [documentPath], [onDocumentOpened], [configurationBlockText], [apiVersion], [initClientOptions], [deprecatedDefaultSerializer], [deprecatedApiVersion])
Parameters:
Name | Type | Description |
---|---|---|
serverUrlOrDocumentParametersObject
|
String | DocumentParametersObject ▼ | The Spotfire Server url, of the form 'http(s)://[server][:port]/spotfire/wp or the DocumentParametersObject. |
serverUrl
|
String | The Spotfire Server url, of the form 'http(s)://[server][:port]/spotfire/wp or the DocumentParametersObject. |
documentPath
|
String | The complete path to the library document or its GUID. |
[ onDocumentOpened ]
|
onDocumentOpenedEventHandler | The callback that will be executed after the document is opened. |
[ configurationBlockText ]
|
String | The configuration block text that will be applied after the document is opened. |
[ apiVersion = '7.14' ]
|
String | The webplayer apiVersion (for Spotfire 7.14+). |
[ initClientOptions ]
|
InitClientOptions ▼ | specific options to be used for web player UI customization |
[ pageIndex ]
|
String | The page index to be opened at start |
[ targetDiv ]
|
String | The location of the iframe for the Web Player |
[ customization ]
|
Object | The customization options. See https://docs.tibco.com/pub/sfire_dev/area/doc/api/TIB_sfire_Web_Player_JavaScript_API_Reference/html/T_spotfire_webPlayer_Customization.htm#! for details |
[ onCreateLoginElement ]
|
onCreateLoginElement | The callback that returns a clickable DOM element to log into spotfire if needed |
[ reloadInstances ]
|
Boolean | Maps the reloadInstances option from Spotfire JS API (WebPlayer only) |
[ emptyDocumentOnOpen ]
|
Boolean | Whether to remove all data tables from the document on open opened. |
[ modApi ]
|
Object | The mods API, to be used from spotfire 11.0 in a Mod context (Custom visualization) |
[ customPythonToolConfiguration ]
|
CustomPythonToolConfiguration | The configuration to create a webconnector that uses custom python tool for execution of python script |
[ documentPath = "/Discngine/Client Automation/empty" ]
|
String | The complete path to the library document. |
[ onDocumentOpened ]
|
onDocumentOpenedEventHandler | The callback that will be executed after the document is opened. |
[ configurationBlockText ]
|
String | The configuration block text that will be applied after the document is opened. |
[ apiVersion = '7.14' ]
|
String | The Web Player apiVersion (for Spotfire 7.14+). |
[ initClientOptions ]
|
InitClientOptions ▼ | The Web Player init client options. |
[ pageIndex ]
|
String | The page index to be opened at start |
[ targetDiv ]
|
String | The location of the iframe for the Web Player |
[ customization ]
|
Object | The customization options. See https://docs.tibco.com/pub/sfire_dev/area/doc/api/TIB_sfire_Web_Player_JavaScript_API_Reference/html/T_spotfire_webPlayer_Customization.htm#! for details |
[ onCreateLoginElement ]
|
onCreateLoginElement | The callback that returns a clickable DOM element to log into spotfire if needed |
[ deprecatedDefaultSerializer ]
|
object | |
[ deprecatedApiVersion ]
|
string |
Members
editor
An instance of SpotfireDocumentEditor
bound to the current SpotfireDocument instance.
Use it to apply modifications to the Spotfire Document.
Example
// Script to add a Bar Chart and Table Plot to the document
spotfireDocument.editor
.addBarChart()
.addTable()
.applyState();
Methods
async applyTemplateAsync(applyParameters) → {Promise}
Apply a template to the current document.
A template is a document with empty data tables. During the process, the data tables are temporarily exported
into SBDF files of the same name and with the extension '.export.sbdf', in the same place as the template.
We therefore advise you to make sure that no SBDF files with these names are present in the location of the template to apply,
otherwise they will be deleted.
Other warning: once the template is applied, it becomes the current document, so the template can easily be
overwritten by accident. A solution to avoid this may be to save the document as a new one, using the
SpotfireDocument.save
function (see the examples).
Parameters:
Name | Type | Description |
---|---|---|
applyParameters
|
Object | Describes the parameters needed to apply the template. |
path
|
String | The path of the template. |
fileName
|
String | The name of the template to be applied. |
[ configurationBlockText ]
|
String | The configuration block text that shall be used to perform an initial configuration of the document after it has been opened. |
[ location = SpotfireDocument.library ]
|
SpotfireDocumentLocation ▼ | The location where the document is saved. |
library
|
String | Document will be save or present in the library |
local
|
String | Document will be save or present in the local directory (only for Analyst) |
Examples
Apply a template from the library:
spotfireDocument.applyTemplateAsync({
path: '/Discngine/Client Automation',
fileName: 'myNewTemplate',
configurationBlockText: 'myKey1="ATextToSave";myKey2=255;'
})
Apply a template from a local file:
spotfireDocument.applyTemplateAsync({
path: 'C:/temp',
fileName: 'myNewTemplate',
location: 'Local'
})
checkSaveLibraryPath(libraryPath)
Throws an exception if the library path passed as args is not a correctly formed path.
Parameters:
Name | Type | Description |
---|---|---|
libraryPath
|
String | a spotfire library path : / |
If the path is not a correctly formed spotfire library path
async clearMarkingAsync(markingName, dataTableName)
Clear the selection for the specified marking and table
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
String | The marking name in which to set the marking. |
dataTableName
|
String | The data table in which to set the marking. |
async closeDocument()
Close the current document.
createWhereClauseForColumnAndValues(idColumnName, ids)
Helper method used to create clause expression for a specific column and a set of values that may be in it.
Parameters:
Name | Type | Description |
---|---|---|
idColumnName
|
String | The name of the column that will contain the ids searched. |
ids
|
Array.<string> | Array.<boolean> | Array.<Number> | The list of values searched. |
Example
spotfireDocument.createWhereClauseForColumnAndValues('Column Name', ['ID1', 'ID2', 'ID3', 'ID4'])
// => [Column Name]="ID1" OR [Column Name]="ID2" OR [Column Name]="ID3" OR [Column Name]="ID4"
dispose()
Disposes all resources that must be disposed and clear all events listeners.
doMandatoryDocumentChangedActions()
Method always called when a document is changed (opened or closed).
doMandatoryDocumentClosedActions()
Method always called when a document is closed.
async executePythonScript(scriptText, scriptArgs)
Execute a python script on the document synchronously. We suggest to avoid using it unless necessary because of its detrimental effect on performance.
Parameters:
Name | Type | Description |
---|---|---|
scriptText
|
String | The script to be executed. |
scriptArgs
|
Object | The list of named parameters that may be used in the script. In python script the args will be used as jsonParam[ |
Example
// Script to hide the column "Column To Hide" from a Table Plot
const hideColumnScript = `
for p in Document.Pages:
for v in p.Visuals:
if v.TypeId.Name == "Spotfire.Table":
chart = v.As[TablePlot]()
(found, column) = chart.Data.DataTableReference.Columns.TryGetValue(jsonParam["columnName"])
if found:
chart.TableColumns.Remove(column)
`;
spotfireDocument.executePythonScript(hideColumnScript, { columnName: "Column To Hide" });
async executePythonScriptAndGetValueAsync(scriptText, scriptArgs) → {Promise}
Execute a python script on the document asynchronously and retrieve the result in a promise.
We suggest to avoid using it unless necessary because of its detrimental effect on performance.
To get the result, use the python functions setResultProperty(serializeToJSON(
Parameters:
Name | Type | Description |
---|---|---|
scriptText
|
String | The script to be executed. |
scriptArgs
|
Object | The list of named parameters that may be used in the script. In python script the args will be used as jsonParam[ |
Example
// Script to get the list of all visualizations in the Spotfire document
const getVisualizationsScript = `
titles = []
for p in Document.Pages:
for v in p.Visuals:
titles.append(v.Title)
setResultProperty(serializeToJSON(titles))
`;
spotfireDocument.executePythonScriptAndGetValueAsync(getVisualizationsScript, {}).then(alert);
async executePythonScriptAsync(scriptText, [scriptArgs]) → {Promise}
Execute a python script on the document asynchronously. We suggest to avoid using it unless necessary because of its detrimental effect on performance.
Parameters:
Name | Type | Description |
---|---|---|
scriptText
|
String | The script to be executed. |
[ scriptArgs ]
|
Object | The list of named parameters that may be used in the script. In python script the args will be used as jsonParam[ |
Example
// Script to hide the column "Column To Hide" from a Table Plot
const hideColumnScript = `
for p in Document.Pages:
for v in p.Visuals:
if v.TypeId.Name == "Spotfire.Table":
chart = v.As[TablePlot]()
(found, column) = chart.Data.DataTableReference.Columns.TryGetValue(jsonParam["columnName"])
if found:
chart.TableColumns.Remove(column)
`;
spotfireDocument.executePythonScriptAsync(hideColumnScript, { columnName: "Column To Hide" }).then(() => alert('Column Hidden'));
async exportTableAsync(exporterType, tableName, [exporterArgs])
Parameters:
Name | Type | Description |
---|---|---|
exporterType
|
SpotfireExporterType ▼ | The type of the exporter to be used. |
local
|
String | Export to local folder. ONLY AVAILABLE IN SPOTFIRE ANALYST |
pipelinePilot
|
String | Export to a Pipeline Pilot server. |
remote
|
String | Export to a remote server using a POST request. |
tableName
|
String | The TIBCO Spotfire® data table containing data to be exported. |
[ exporterArgs ]
|
LocalExporterArgs | PipelinePilotExporterArgs | RemoteExporterArgs ▼ | Exporter parameters to be used to export the data. Along the exporter specific parameters, the following common ones are available: |
url
|
string | The url to send the data to |
fieldName
|
string | The name of the field in form-data which will contain the file |
headers
|
Object | Optional headers to send with the request |
Examples
exporterArgs = {
serverRoot: 'http://serverFQDN:port/',
sessionId: 'AZERTYUIOIPSDJKLMD123456789',
destinationPath: 'C:/Program Files/BIOVIA/PPS/web/jobs/myUserName/AABBCCDD1234'
};
spotfireDocument.exportTableAsync(SpotfireExporterType.pipelinePilot, 'aTable', exporterArgs);
exporterArgs = {
serverRoot: 'http://serverFQDN:port/',
sessionId: 'AZERTYUIOIPSDJKLMD123456789',
destinationPath: 'C:/Program Files/BIOVIA/PPS/web/jobs/myUserName/AABBCCDD1234',
filterRows: {
type: SpotfireFilterRowType.marking
},
columns: ['Activity', 'ALogP']
};
spotfireDocument.exportTableAsync(SpotfireExporterType.pipelinePilot, 'aTable', exporterArgs);
exporterArgs = {
serverRoot: 'http://serverFQDN:port/',
sessionId: 'AZERTYUIOIPSDJKLMD123456789',
destinationPath: 'C:/Program Files/BIOVIA/PPS/web/jobs/myUserName/AABBCCDD1234',
destinationFile: 'markedData.sbdf'
filterRows: {
type: SpotfireFilterRowType.marking,
name: 'Marking'
}
};
spotfireDocument.exportTableAsync(SpotfireExporterType.pipelinePilot, 'aTable', exporterArgs);
exporterArgs = {
serverRoot: 'http://serverFQDN:port/',
sessionId: 'AZERTYUIOIPSDJKLMD123456789',
destinationPath: 'C:/Program Files/BIOVIA/PPS/web/jobs/myUserName/AABBCCDD1234',
destinationFile: 'markedData.sbdf'
filterRows: {
type: SpotfireFilterRowType.filtering
}
};
spotfireDocument.exportTableAsync(SpotfireExporterType.pipelinePilot, 'aTable', exporterArgs);
Exporting a file on your local drive.
WARNING! ONLY WORKS IN ANALYST AS YOU DO NOT HAVE ACCESS TO FILE SYSTEM IN WEB PLAYER.
exporterArgs = {
destinationPath: 'C:/Users/YourName/Documents',
destinationFile: 'myTable.sbdf'
};
spotfireDocument.exportTableAsync(SpotfireExporterType.local, 'aTable', exporterArgs);
Exporting to a remote server on 'https://server.com/
exporterArgs = {
url: 'https://server.com/upload',
fieldName: 'file',
headers: {
'Authorization': 'Bearer xxx'
}
};
spotfireDocument.exportTableAsync(SpotfireExporterType.remote, 'aTable', exporterArgs);
async getActiveDataTableAsync() → {Promise.<String>}
Gets the name of the active data table.
A data table name.
async getActiveMarkingAsync() → {Promise.<String>}
Gets the active marking name of the active visual.
async getDataColumnsAsync(dataTableName) → {Promise.<Array.<String>>}
Gets the list of data table names with their identifiers.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table. |
An array of columns names.
Example
spotfireDocument.getDataColumnsAsync("Maybridge-200").then(console.log);
// outputs something like
['Column A', 'Column B', 'Column C']
async getDataColumnsPropertiesAsync(dataTableName) → {Promise.<Array.<DataTableColumnProperties>>}
Gets the list of properties for all columns of a data table.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table. |
Example
spotfireDocument.getDataColumnsPropertiesAsync("My Data Table").then(console.log);
// outputs something like
[{
contentType: "chemical/x-mdl-molfile",
dataType: "Binary",
description: "",
expression: "",
externalId: null,
externalName: "Structure <MOLFILE>",
name: "Structure <MOLFILE>"
},
{
contentType: null,
dataType: "String",
description: "",
expression: "",
externalId: null,
externalName: "CODE",
name: "CODE"
}]
async getDataFunctionFromLibraryAsync(pathOrGuid) → {Promise.<DataFunctionDefinition>}
Retrieves the definition of a data function registered in the Spotfire Library.
Parameters:
Name | Type | Description |
---|---|---|
pathOrGuid
|
String | path or GUID of the data function to get from the library. |
The data function definition.
async getDataTableContentAsync([table], [marking], [from], [to], [columns], [delimiter]) → {Promise.<String>}
Deprecated Gets the content of a data table in STDF format. Gets the whole data table or specific rows and/or columns.
Parameters:
Name | Type | Description |
---|---|---|
[ table ]
|
String | The name of the data table. |
[ marking ]
|
String | The name of the marking. |
[ from ]
|
Number | The first row index of a range of rows. |
[ to ]
|
Number | The last row index of a range of rows. |
[ columns ]
|
String | The list of columns, concatenated with a delimiter. |
[ delimiter ]
|
String | The delimiter used for the list of columns. |
The content of a data table.
async getDataTableNamesAsync() → {Promise.<Array.<String>>}
Gets the names of all data tables in the document.
An array of data tables names.
async getDataTablePropertiesAsync(dataTableName) → {Promise.<Array.<DataTableProperty>>}
Gets the list of properties of the data table.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table. |
Example
spotfireDocument.getDataTablePropertiesAsync("My Data Table").then(console.log);
// outputs something like
[{
name: "Color",
value: {
R: 100,
G: 137,
B: 250,
A: 255,
IsKnownColor: false,
IsEmpty: false,
IsNamedColor: false,
IsSystemColor: false,
Name: "ff6489fa"
}
}, {
name: "Description",
value: "Lorem ipsum"
}]
async getDataTablePropertyAsync(dataTableName, dataTablePropertyName) → {Promise.<DataTableProperty>}
Gets the value of a given property of the data table.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table. |
dataTablePropertyName
|
String | The name of the property. |
Example
spotfireDocument.getDataTablePropertiesAsync("My Data Table", "color").then(console.log);
// outputs something like
{
name: "Color",
value: {
R: 100,
G: 137,
B: 250,
A: 255,
IsKnownColor: false,
IsEmpty: false,
IsNamedColor: false,
IsSystemColor: false,
Name: "ff6489fa"
}
}
async getDataTableRowsCountAsync(dataTableName) → {Promise.<Number>}
Gets the row count for the specified data table.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table. |
async getDataTablesNamesByIdsAsync() → {Promise.<Array.<Object>>}
Gets the names and GUIDs of all data tables in the document.
An array of objects of the shape { name: String, id: String }.
Example
spotfireDocument.getDataTablesNamesByIdsAsync().then(console.log)
// outputs something like
[{
id: "2a2f783a-ad48-48b5-b93d-9af04d6618f7",
name: "Table A"
}, {
id: "be1b0c51-b086-4d28-b4c7-ee47ee82047b",
name: "Table B"
}]
async getDataTablesSaveSettingsAsync() → {Promise.<Array.<DataTableSaveSettings>>}
Gets the list of the "save settings" of all the data tables.
The list of the "save settings".
async getLibraryContentAsync([parentId], [fullInformation]) → {Promise.<Object>}
Retrieves the content of a folder in the Spotfire Library.
Parameters:
Name | Type | Description |
---|---|---|
[ parentId ]
|
String | GUID of the parent folder to read. If empty, content of home folder will be returned. |
[ fullInformation ]
|
Boolean | If true, the analysis, dataFiles and dataFunctions arrays will contain objects as {path, id}. If false (default), they will contain path as string. |
- The folder structure as {analysis: [], dataFiles: [], dataFunctions: [], subFolders: []}
async getMarkedRowsAsync([markingName], [dataTableName]) → {Promise.<Object>}
Get the list of marked rows with content.
Parameters:
Name | Type | Description |
---|---|---|
[ markingName = 'active marking name' ]
|
String | The marking name that we want to get the marked rows. |
[ dataTableName = 'active data table name' ]
|
String | The data table name that is marked. |
- An object which keys are the name of the columns and the values arrays of the selected values.
Example
spotfireDocument.getMarkedRowsAsync('MyMarking','aTable').then(function(markedRows) {
alert(markedRows);
})
async getMarkingsAsync() → {Promise.<Array.<String>>}
Gets all marking names.
async getMetadataAsync() → {Promise.<Object>}
List the metadata of the document.
An object containing metadata of the document ('path', 'created', etc.).
Example
spotfireDocument.getMetadataAsync().then(console.log)
// Outputs something like
{
contentSize: "139246",
created: "02/11/2018 09:49:45",
description: "",
lastModified: "02/20/2020 16:07:00",
path: "/Discngine (Connector 5.x)/Client Automation/empty",
title: "empty"
}
async getPropertiesAsync() → {Promise.<Array.<Object>>}
Gets the value of all defined document properties.
An array of objects of the shape { name: String, value: String }.
Example
spotfireDocument.getPropertiesAsync().then(console.log);
// Outputs something like
[
{name: "Description", value: ""},
{name: "Keywords", value: Array(0)},
{name: "AllowWebPlayerResume", value: "False"},
...
]
async getPropertyAsync(propertyName) → {Promise.<String>}
Gets the value of a document property.
Parameters:
Name | Type | Description |
---|---|---|
propertyName
|
String |
The string value of the property.
Example
spotfireDocument.getPropertyAsync('PublicBookmarkCreation').then(console.log); // => "RequiresReadAndWriteAccess"
async isDocumentOpen() → {Promise.<Boolean>}
True if a document is opened, false if not.
async markingExistsAsync(markingName) → {Promise.<Boolean>}
Does the marking provided exist?
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
String | The name of the marking to check. |
async markRowsAsync(markingName, dataTableName, whereClause, [operation]) → {Promise}
Sets a marking in the analysis specified by the input parameters.
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
String | The marking name in which to set the marking. |
dataTableName
|
String | The data table in which to set the marking. |
whereClause
|
String | An expression string with conditions for the data columns used to set the marking. For more information, see the documentation for the TIBCO Spotfire® Expression Language. |
[ operation = SpotfireDataSelectionOperations.replace ]
|
SpotfireDataSelectionOperations ▼ | The operation to use when combining this selection with previously set selections. |
replace
|
String | Replaces the given marking with the new conditions specified in the where clause. |
add
|
String | Adds rows from the specified where clause to the given marking. |
subtract
|
String | Removes rows from the specified where clause in the given marking. |
toggle
|
String | Toggles between the current marking and the result of the specified where clause. |
intersect
|
String | Intersects the current marking with the marking specified in the where clause. |
Example
spotfireDocument.markRowsAsync('MyMarking (0)','aTable','[Activity] <= 0', SpotfireDataSelectionOperations.add)
async markRowsByIdsAsync(markingName, dataTableName, idColumnName, ids) → {Promise}
Mark rows identified by column and specified values for specified marking and data table.
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
String | The name of the marking in which you want to mark the rows. |
dataTableName
|
String | The name of the dataTable from where you want to mark rows. |
idColumnName
|
String | The name of the column that represents the id on which you want to select the rows. |
ids
|
Array.<String> | Array of ids that identified the rows to mark. |
Example
spotfireDocument.markRowsByIdsAsync('MyMarking (1)', 'aTable', 'InChIKey', [
'APZFVJKUDMXDFA-UHFFFAOYSA-N',
'LQUMXBMVHBUSOC-UHFFFAOYSA-N',
'KJTUBZKMFRILQD-UHFFFAOYSA-N',
'WYCLKVQLVUQKNZ-UHFFFAOYSA-N'
])
async onDataColumnsChanged(dataTableName, callback)
Adds a new callback to be executed when the list of data tables has changed.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The data table to watch. |
callback
|
onDataColumnsChangedCb | The callback to be executed when the list of Data Columns has changed. |
async onDataTablesChanged(callback)
Adds a new callback to be executed when the list of data tables has changed.
Parameters:
Name | Type | Description |
---|---|---|
callback
|
onDataTablesChangedCb | The callback to be executed on closed changed event. |
async onDocumentChanged(callback) → {Promise.<(Number|Boolean)>}
Configures a callback that will be executed when a document has changed. Note that these callbacks can potentially be executed frequently.
Parameters:
Name | Type | Description |
---|---|---|
callback
|
onDocumentChangedCb ▼ | The callback to be executed on document changed event. |
analysisPath
|
String | The path of the document which was changed. |
The number of registered callback in case of success, false
otherwise.
async onDocumentClosed(callback)
Configures a callback that will be executed when a document is closed.
Parameters:
Name | Type | Description |
---|---|---|
callback
|
onDocumentClosedCb ▼ | The callback to be executed on closed changed event. |
analysisPath
|
String | The path of the document which was closed. |
async onMarkingChanged(markingName, dataTableName, callback)
Configures the callback that will be called when a specific marking has changed for a specific data table. LIMITATION: in web player, all callbacks are called when a marking changes, regardless of whether it happens in the specified data table.
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
String | The marking to listen to. |
dataTableName
|
String | The datatable to listen to. |
callback
|
onMarkingChangedCb ▼ | The callback that will be executed when the marking changed for the corresponding data table. |
markedRows
|
Array.<MarkedRows> | The list of newly marked rows. |
async openDocument(documentPath, [onDocumentOpenedCb], [configurationBlockText], [location], [forceIdempotent])
Opens an existing document from library or from a local file. In the Web Player, only files from library can be opened.
Parameters:
Name | Type | Description |
---|---|---|
documentPath
|
String | The full path to the document in the library, or to a local drive if you are using only the TIBCO Spotfire ® Analyst client</>. |
[ onDocumentOpenedCb ]
|
onDocumentOpenedEventHandler | The callback that will be executed after the document is opened. |
[ configurationBlockText ]
|
String | The configuration block text to be applied. |
[ location = SpotfireDocumentLocation.library ]
|
SpotfireDocumentLocation ▼ | The location type of the document, from enum |
library
|
String | Document will be save or present in the library |
local
|
String | Document will be save or present in the local directory (only for Analyst) |
[ forceIdempotent ]
|
boolean | If true, the document will be opened in an idempotent way, meaning that the document will be opened only if it is not already opened. used only in webpanel for webplayer context. |
Examples
Open a document from the library:
spotfireDocument.openDocument('/Discngine/Client Automation/empty')
Open a document from a local file:
spotfireDocument.openDocument('C:/temp/data.dxp', null, null, SpotfireDocumentLocation.local)
Open a document with a configuration block and a callback function:
spotfireDocument.openDocument('/MyTeam/data.dxp', function() {alert('document opened')}, 'myKey1="ATextToSave";myKey2=255;')
removeOnDataColumnsChanged(dataTableName, callback)
Removes a callback previously registered with the SpotfireDocument#onDataTablesChanged
method.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | boolean | The data table for which the callback was registered. |
callback
|
boolean | onDataColumnsChangedCb | The callback to unregister. |
removeOnDataTablesChanged(callback)
Removes a callback previously registered with the SpotfireDocument#onDataTablesChanged
method.
Parameters:
Name | Type | Description |
---|---|---|
callback
|
boolean | onDataTablesChangedCb | The callback to unregister. |
removeOnDocumentChanged(callback)
Removes a callback previously registered with the SpotfireDocument#onDocumentChanged
method.
Parameters:
Name | Type | Description |
---|---|---|
callback
|
boolean | onDocumentChangedCb ▼ | The callback to unregister. |
analysisPath
|
String | The path of the document which was changed. |
removeOnDocumentClosed(callback)
Removes a callback previously registered with the SpotfireDocument#onDocumentClosed
method.
Parameters:
Name | Type | Description |
---|---|---|
callback
|
boolean | onDocumentClosedCb ▼ | The callback to unregister. |
analysisPath
|
String | The path of the document which was closed. |
removeOnMarkingChanged(markingName, dataTableName, callback)
Removes a callback previously registered with the SpotfireDocument#onMarkingChanged
method.
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
String | true | The marking for which the callback was registered. |
dataTableName
|
String | boolean | undefined | The data table for which the callback was registered. |
callback
|
boolean | undefined | onMarkingChangedCb ▼ | The callback to unregister. |
markedRows
|
Array.<MarkedRows> | The list of newly marked rows. |
async save(saveOptionsOrLibraryPath, panelsVisibilities)
Saves the document.
Parameters:
Name | Type | Description |
---|---|---|
saveOptionsOrLibraryPath
|
String | DocumentSaveOptions ▼ | List all options for saving the document. If array is string, assuming that the save operation is done in the library. |
path
|
String | The existing destination path of the document to be saved. |
fileName
|
String | The name of the document to be saved. |
[ configurationBlockText ]
|
String | The configuration block text that shall be embedded in the file when the document is saved. |
[ location = SpotfireDocument.library ]
|
SpotfireDocumentLocation ▼ | The location where to save the document, from enum |
library
|
String | Document will be save or present in the library |
local
|
String | Document will be save or present in the local directory (only for Analyst) |
[ libraryItemMetaData ]
|
LibraryItemMetaData ▼ | The metadata to associate with the library item (not available if the document is saved locally). |
[ description = '' ]
|
String | the description |
[ otherData ]
|
Object | the list of all custom metadata you want to pull as metadata for the library document |
[ singleExecution ]
|
Boolean | If true, indicate that the save process has to be executed only once. Set this flag to true if the save action is done in a onSuccess call and that the webPanel is hidden for the save. |
panelsVisibilities
|
PanelsVisibilities ▼ | The visibility of the panels to be available on save for active page. |
[ webPanel ]
|
Boolean | The visibility of the data panel. |
[ filters ]
|
Boolean | The visibility of the filter panel. |
[ detailsOnDemand ]
|
Boolean | The visibility of the details on demand panel. |
[ tags ]
|
Boolean | The visibility of the tags panel. |
[ lists ]
|
Boolean | The visibility of the lists panel. |
[ bookmarks ]
|
Boolean | The visibility of the bookmarks panel. |
[ webPage ]
|
Boolean | The visibility of the webpage panel. |
Examples
Save the document as it is:
spotfireDocument.save()
Save the document as a new document in local folder (FOR ANALYST ONLY):
spotfireDocument.save({
path:'c:\\TMP\\',
fileName:'NewFileName.dxp',
location: SpotfireDocumentLocation.local
})
Save the document as a new document in local folder (FOR ANALYST ONLY) with a configuration block:
spotfireDocument.save({
path:'c:\\TMP\\',
fileName:'NewFileName.dxp',
location: SpotfireDocumentLocation.local,
configurationBlockText: 'myKey1="ATextToSave";myKey2=255;'
})
Save the document as a new document in library:
spotfireDocument.save({
path:'/myLibraryFolder/',
fileName:'NewFileName'
})
Save the document as a new document in library with configurationBlockText:
spotfireDocument.save({
path:'/myLibraryFolder/',
fileName:'NewFileName',
configurationBlockText: 'myKey1="ATextToSave";myKey2=255;'
})
saveAsync(saveOptionsOrLibraryPath, panelsVisibilities) → {Promise}
Asynchronous version of the SpotfireDocument.save
method. This method can be replaced by the save method which is now async
- Deprecated:
- Yes
Parameters:
Name | Type | Description |
---|---|---|
saveOptionsOrLibraryPath
|
String | DocumentSaveOptions ▼ | List all options for saving the document. If array is string, assuming that the save operation is done in the library. |
path
|
String | The existing destination path of the document to be saved. |
fileName
|
String | The name of the document to be saved. |
[ configurationBlockText ]
|
String | The configuration block text that shall be embedded in the file when the document is saved. |
[ location = SpotfireDocument.library ]
|
SpotfireDocumentLocation ▼ | The location where to save the document, from enum |
library
|
String | Document will be save or present in the library |
local
|
String | Document will be save or present in the local directory (only for Analyst) |
[ libraryItemMetaData ]
|
LibraryItemMetaData ▼ | The metadata to associate with the library item (not available if the document is saved locally). |
[ description = '' ]
|
String | the description |
[ otherData ]
|
Object | the list of all custom metadata you want to pull as metadata for the library document |
[ singleExecution ]
|
Boolean | If true, indicate that the save process has to be executed only once. Set this flag to true if the save action is done in a onSuccess call and that the webPanel is hidden for the save. |
panelsVisibilities
|
PanelsVisibilities ▼ | The visibility of the panels to be available on save for active page. |
[ webPanel ]
|
Boolean | The visibility of the data panel. |
[ filters ]
|
Boolean | The visibility of the filter panel. |
[ detailsOnDemand ]
|
Boolean | The visibility of the details on demand panel. |
[ tags ]
|
Boolean | The visibility of the tags panel. |
[ lists ]
|
Boolean | The visibility of the lists panel. |
[ bookmarks ]
|
Boolean | The visibility of the bookmarks panel. |
[ webPage ]
|
Boolean | The visibility of the webpage panel. |
async saveTemplateAsync(saveParameters) → {Promise}
Saves the document as a template. A template is a document with empty data tables. During the process, the data tables are temporarily exported into SBDF files of the same name and with the extension '.export.sbdf', in the same place as the template. We therefore advise you to make sure that no SBDF files with these names are present in the location of the future template, otherwise they will be deleted.
Parameters:
Name | Type | Description |
---|---|---|
saveParameters
|
DocumentSaveOptions ▼ | Describes the parameters needed to save the template. |
path
|
String | The existing destination path of the document to be saved. |
fileName
|
String | The name of the document to be saved. |
[ configurationBlockText ]
|
String | The configuration block text that shall be embedded in the file when the document is saved. |
[ location = SpotfireDocument.library ]
|
SpotfireDocumentLocation ▼ | The location where to save the document, from enum |
library
|
String | Document will be save or present in the library |
local
|
String | Document will be save or present in the local directory (only for Analyst) |
[ libraryItemMetaData ]
|
LibraryItemMetaData ▼ | The metadata to associate with the library item (not available if the document is saved locally). |
[ description = '' ]
|
String | the description |
[ otherData ]
|
Object | the list of all custom metadata you want to pull as metadata for the library document |
[ singleExecution ]
|
Boolean | If true, indicate that the save process has to be executed only once. Set this flag to true if the save action is done in a onSuccess call and that the webPanel is hidden for the save. |
Examples
Save a template in the library:
spotfireDocument.saveTemplateAsync({
path: '/Discngine/Client Automation',
fileName: 'myNewTemplate',
configurationBlockText: 'myKey1="ATextToSave";myKey2=255;'
})
Save a template in an existing local folder:
spotfireDocument.saveTemplateAsync({
path: 'C:/temp',
fileName: 'myNewTemplate',
location: 'Local'
})
async searchLibraryContentAsync(searchExpression, [fullInformation]) → {Promise.<Object>}
Retrieves the content matching the specified search expression in the Spotfire Library.
Parameters:
Name | Type | Description |
---|---|---|
searchExpression
|
String | An expression describing the items that shall be returned. The syntax used is the same as in the search field in the "Open from Library" dialog. |
[ fullInformation ]
|
Boolean | If true, the analysis, dataFiles and dataFunctions arrays will contain objects as {path, id}. If false (default), they will contain path as string. |
- The folder structure as {analysis: [], dataFiles: [], dataFunctions: [], subFolders: []}
setSpinnerState(isActive, [message], [timeout]) → {this}
Allows to add a spinner containing a custom message to indicate when Spotfire is
working. This can be convenient to prevent multiple blinking caused by Python scripts
being executed sequentially. Calling the method multiple times while changing message
allows to update the message displayed to the user.
Parameters:
Name | Type | Description |
---|---|---|
isActive
|
Boolean | Whether to show or hide the spinner. |
[ message ]
|
String | The message you want to display on the screen. |
[ timeout = 10000 ]
|
Number | String | The time in ms after which the spinner will be unset automatically. You can disable it by explicitly passing 0. |
Returned with this
to allow chaining.
subscribeToDocumentEvents()
Subscribes the mandatory handlers to document event (closed and changed). Will be recall on document changed.