Constructor
new SpotfireConnector(serverUrl, documentPath, onConnectorReady, [configurationBlockText], [internalSpotfireConnector], [libraryAccessors], [apiVersion])
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
serverUrl
|
String | URL of the serverUrl where Spotfire is hosted |
||
documentPath
[Inherited]
|
String | Path of the document to open |
||
configurationBlockText
[Inherited]
|
String |
<optional> |
The configuration block text to be set up on opening if needed |
|
libraryAccessors
[Inherited]
|
Object |
<optional> |
Custom Serializer Library Accessor |
|
onConnectorReady
|
onConnectorReadyCb | the on connector ready handler that will be called when the connector is ready to used |
||
internalSpotfireConnector
|
SpotfireConnectorBase |
<optional> |
Custom |
|
apiVersion
|
String |
<optional> |
'7.14' | web player api version (for Spotfire 7.14+) |
Methods
addAsColumnsIntoDataTableFromUrl(urlSource, dataTableTarget, [addColumnsSettings])
Imports source from url as columns in the target data table
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
urlSource
|
string | the url of the source to import |
|
dataTableTarget
|
string | the name of the target datatable |
|
addColumnsSettings
|
addColumnsSettings |
<optional> |
the settings that will be used to make the import |
appendDefaultPropertiesToParams([params])
Add mandatory properties to parameters (notification label and execution guid)
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object |
<optional> |
the list of parameters to be used in the script |
applyTemplateAsync(applyParameters)
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).
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
applyParameters
|
TemplateApplyOptions | Describes the parameters needed to apply the template. |
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'
})
checkExportArgsAsync(dataTableName, exporterArgs)
Checks the consistency of the exporter arguments and raise exception if needed
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable to export |
exporterArgs
|
Object | the args that will be used with the current exporter |
createScriptComposer()
Creates a copy of the current script composer. Used for get methods
- Inherited From:
createWhereClauseForColumnAndValues(idColumnName, ids)
Gets a where clause expression for a specific column and a set of values that may be in it
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
idColumnName
|
String | the name of the column that will contains the ids searched |
ids
|
Array.<string> | Array.<boolean> | Array.<numeric> | the list of values searched |
dataTableExistsAsync(dataTableName)
Indicates whether the data table exists in the current document
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable to check |
executePython(python)
Executes an IronPython script
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
python
|
string | the python script to be executed |
executePythonAndGetValue(python) → {Promise}
Executes a python script and gets the return value from it. Async method
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
python
|
string | the python script to be executed |
exportDataTables(dataTables, path)
Exports the provided list of data tables into separate SBDF files, named with the name of the data table and with the extension '.export.sbdf'. Overload for the TIBCO Spotfire® Analyst client.
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTables
|
Array.<String> | The list of names of the data tables to be exported. |
path
|
String | The path of the folder in which the SBDF files are to be saved. |
generateGuid()
Generates a guid to identify each script execution. Needed to avoid execution race issues when getting a return value from the IronPython script
- Inherited From:
getActiveDataTableAsync()
Gets the name of the active data table
- Inherited From:
getActiveMarkingAsync()
Get the active marking name of the active visual
- Inherited From:
Example
spotfireDocument.getActiveMarkingAsync().then(function(name) {
alert(name);
}, alert)
getDataColumnsPropertiesAsync(dataTableName)
Gets the list of properties for all columns of a data table
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable |
getDataSourceColumnsAsync(urlSource) → {Array.<string>}
Gets the list of column names of an url source
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
urlSource
|
string | the url of the source to extract list of column |
- the list of column names from the source
getDataTableNames()
Gets the list of data table names (sync method)
- Inherited From:
getDataTableNamesAsync()
Gets the list of data table names (async method)
- Inherited From:
getDataTablePropertiesAsync(dataTableName) → {Array.<DataTableProperty>}
Gets the list of properties of the data table
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable |
getDataTablePropertyAsync(dataTableName, propertyName)
Gets the value of a given property of the data table
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable |
propertyName
|
string | the name of the property |
getDataTableRowsCountAsync(dataTableName) → {Number}
Gets the row count for the specified data table.
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table. |
getDataTablesNamesByIdsAsync()
Gets the list of data table names with their identifiers
- Inherited From:
getDataTablesSaveSettingsAsync() → {Array.<DataTableSaveSettings>}
Gets the list of the "save settings" of all the data tables.
- Inherited From:
The list of the "save settings".
getInternalConnector()
Creates instance of the correct Spotfire Connector class based on the context of the current instance
getMarkedRowsAsync(markingName, dataTableName)
Get the list of marked rows with content
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
String | the marking name that we want to get the marked rows |
dataTableName
|
String | the dataTable name that is marked |
Example
spotfireDocument.getMarkedRowsAsync('MyMarking','aTable').then(function(markedRows) {
alert(markedRows);
})
getMarkingsAsync()
Get all marking names
- Inherited From:
Example
spotfireDocument.getMarkingsAsync().then(function(names) {
var namesAsString = '';
for(var i in names) {
namesAsString += names[i] + ';'
}
alert(namesAsString);
}, alert)
getMetadataAsync()
Gets the metadata of the current document
- Inherited From:
getPropertiesAsync()
Gets all properties of the current document
- Inherited From:
getPropertyAsync(propertyName)
Gets the value of the current document property
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
propertyName
|
String | The name of the required property |
getScriptForExport(scriptArgs)
Gets the script for exporting
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
scriptArgs
|
Object | the list of args to be used in the export script |
initClient()
Initializes the client. to use after instanciation of the connector object
- Inherited From:
isAnalyst() → {Boolean}
Checks if the current context is the Analyst client or the web player
isDocumentOpened() → {Boolean}
Indicates whether the document is already open
- Inherited From:
loadDataFromUrl(url, dataTableName)
Adds a datatable from the specified url to the current document
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
url
|
string | the url of the data to import |
dataTableName
|
string | the name of the datatable to be created/replace |
markingExistsAsync(markingName)
Does the marking provided exist?
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
String | The name of the marking to be checked. |
onDocumentChanged(onDocumentChangedCallback)
Configures the callback that will be executed when a document is opened
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
onDocumentChangedCallback
|
onDocumentChangedCb | the callback to be executed on document opened event |
onDocumentClosed(onDocumentClosedCallback)
Configures the callback that will be executed when a document is closed
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
onDocumentClosedCallback
|
onDocumentClosedCb | the callback to be executed on document closed event |
onMarkingChanged(markingName, dataTableName, resultDataColumns, resultMaxRowCount)
Configures the callback that will be called when a specific marking has changed for a specific data column
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
markingName
|
string | the marking to listen to |
dataTableName
|
string | the datatable marked to listen to |
resultDataColumns
|
Array.<string> | the list of data columns to return in the list of marked rows |
resultMaxRowCount
|
number | the maximum number of rows to be returned |
onReady(onConnectorReadyHandler)
Configures the callback that will be executed when the connector is ready (depends on the kind of connector Analyst/WebPlayer)
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
onConnectorReadyHandler
|
onConnectorReadyCb | the callback to be executed when the connector is ready |
openDocument(documentPath, [onDocumentOpenedHandler], [configurationBlockText])
Opens an existing document from the library.
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
documentPath
|
String | The full path to the library document. |
|
onDocumentOpenedHandler
|
DocumentOpenedEventHandler |
<optional> |
The callback that will be executed after the document is opened. |
configurationBlockText
|
String |
<optional> |
The configuration block text that shall be used to perform an initial configuration of the document after it has been opened. Defaults to the empty string, which means that no configuration will be made. |
parsePythonScriptResult(resultAsString)
Converts the returnValue property of the current spotfire document into an object
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
resultAsString
|
string | the value of the spotfire document property that may be named this.prototype.RESULT_PROPERTY_NAME (extracted from the application context). It is a stringified JSON object that may look like this : "Discngine.WebPanelForWebPlayer.Script.Return":"{ \"b267364e-e1f1-d661-99bf-8e0cedcda9ad\":\"[{\\"id\\":\\"00cb5211-960b-4e71-8238-79eed23c35a2\\",\\"name\\":\\"aTable\\"}]\", \"ec650e9d-c03a-6da1-8fd4-865464e4862f\":\"[{\\"value\\":{\\"R\\":100,\\"G\\":137,\\"B\\":250,\\"A\\":255,\\"IsKnownColor\\":false,\\"IsEmpty\\":false,\\"IsNamedColor\\":false,\\"IsSystemColor\\":false,\\"Name\\":\\"ff6489fa\\"},\\"name\\":\\"Color\\"},{\\"value\\":\\"\\",\\"name\\":\\"Description\\"}]\" }" }" where guid is the execution id of the script |
raisePythonExecutionErrorIfNeeded()
Checks on the document property if an exception has occurred during the script execution and raised it if needed
- Inherited From:
rebuildDocumentAfterSaveOrApplyTemplate(dataTables, options)
Base internal function to rebuild the document after saving or applying a template. Overload for the TIBCO Spotfire® Analyst client. This rebuild consists of importing all the data tables that have been saved in temporary SBDF files in the same location as the template, and removing these temporary files.
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTables
|
Array.<String> | The list of names of the data tables to be imported into the document. |
options
|
DocumentSaveOptions | TemplateApplyOptions |
removeRowsFromDataTable(dataTable)
Removes all the rows from a data table.
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTable
|
String | The name of the data table in which all rows are to be removed. |
removeScriptResultValue(executionGuid)
Removes the return value for the corresponding script execution Id
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
executionGuid
|
string | the id of the current execution to be removed from the return value dictionary structure |
save([saveOptions])
Save the document with options
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
saveOptions
|
DocumentSaveOptions |
<optional> |
describe the save options. If not provided the document will be saved as is. |
saveTemplateAsync(saveParameters)
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.
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
saveParameters
|
DocumentSaveOptions | Describes the parameters needed to save the template. |
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'
})
setDataTablePropertyAsync(dataTableName, propertyName, value)
Sets/Adds the value of a data table property
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable to modify |
propertyName
|
string | the name of the property to add/set |
value
|
the value to be add/set |