Constructor
new SpotfireConnectorBase(serverUrl, documentPath, [configurationBlockText], [libraryAccessors])
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
serverUrl
|
String | URL of the serverUrl where Spotfire is hosted |
|
documentPath
|
String | Path of the document to open |
|
configurationBlockText
|
String |
<optional> |
The configuration block text to be set up on opening if needed |
libraryAccessors
|
Object |
<optional> |
Custom Serializer Library Accessor |
Methods
static getDataColumnsAsync(dataTableName)
Gets the list of data columns for a given data table
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable |
addAsColumnsIntoDataTableFromUrl(urlSource, dataTableTarget, [addColumnsSettings])
Imports source from url as columns in the target data table
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 |
targetIdColumn
|
string | the name of the column used as identifier in the target datatable |
|
sourceIdColumn
|
string | the name of the column used as identifier in the imported source |
|
otherColumnsMatching
|
Array.<ColumnMatching> ▼ | list of columns matching to apply. The column of the target will be replace by default by the imported column |
|
[].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
|
boolean |
<optional> |
indicate if all common columns are replace or duplicated (using number to identify imported column) |
columnsToReplace
|
Array.<string> |
<optional> |
list of columns to be replaced by imported ones (if you do not want to have all common columns to be replaced) |
appendDefaultPropertiesToParams([params])
Add mandatory properties to parameters (notification label and execution guid)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object |
<optional> |
the list of parameters to be used in the script |
checkExportArgsAsync(dataTableName, exporterArgs)
Checks the consistency of the exporter arguments and raise exception if needed
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
createWhereClauseForColumnAndValues(idColumnName, ids)
Get a where 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 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
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable to check |
executePython(python)
Executes an IronPython script
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
Parameters:
Name | Type | Description |
---|---|---|
python
|
string | the python script to be executed |
generateGuid()
Generates a guid to identify each script execution. Needed to avoid execution race issues when getting a return value from the IronPython script
getActiveDataTableAsync()
Gets the name of the active data table
getDataColumnsPropertiesAsync(dataTableName)
Gets the list of properties for all columns of a data table
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
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)
getDataTableNamesAsync()
Gets the list of data table names (async method)
getDataTablePropertiesAsync(dataTableName) → {Array.<DataTableProperty>}
Gets the list of properties of the data table
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
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 datatable
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
string | the name of the datatable |
getDataTablesNamesByIdsAsync()
Gets the list of data table names by ids
getMarkingsAsync()
Get all marking names
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
getPropertiesAsync()
Gets all properties of the current document
getPropertyAsync(propertyName)
Gets the value of the current document property
Parameters:
Name | Type | Description |
---|---|---|
propertyName
|
String | The name of the required property |
getScriptForExport(scriptArgs)
Gets the script for exporting
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
isDocumentOpened() → {Boolean}
Indicates whether the document is already open
loadDataFromUrl(url, dataTableName)
Adds a datatable from the specified url to the current document
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?
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
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
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
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)
Parameters:
Name | Type | Description |
---|---|---|
onConnectorReadyHandler
|
onConnectorReadyCb | the callback to be executed when the connector is ready |
openDocument(documentPath, [onDocumentOpenedHandler], [configurationBlockText])
Open a document from the library with the specified configurationBlockText
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
documentPath
|
String | the complete path to the library document |
|
onDocumentOpenedHandler
|
DocumentOpenedEventHandler |
<optional> |
the callback that will be executed after the document is opened |
configurationBlockText
|
String |
<optional> |
the configurationBlockText to be applied on the document at opening |
parsePythonScriptResult(resultAsString)
Converts the returnValue property of the current spotfire document into an object
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
removeScriptResultValue(executionGuid)
Removes the return value for the corresponding script execution Id
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
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
saveOptions
|
DocumentSaveOptions ▼ |
<optional> |
describe the save option. If not provided the document will be saved as is. |
path
|
String | the existing path where to save |
|
fileName
|
String | the name of the saved file |
|
configurationBlockText
|
String |
<optional> |
the configuration block text to be saved in the Spotfire document |
location
|
SpotfireDocumentLocation {Enum} ▼ |
<optional> |
the location where to save the document from |
Enum options: library, local | |||
libraryItemMetaData
|
LibraryItemMetaData ▼ |
<optional> |
the list of metadata to be saved on the document spofire if it is a Spotfire Document stored in library |
description
|
String |
<optional> |
the description |
otherData
|
Object |
<optional> |
the list of all custom metadata you want to pull as metadat for the library document |
setDataTablePropertyAsync(dataTableName, propertyName, value)
Sets/Adds the value of a data table property
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 |