new Connector()
A native Tableau web data connector object, decorated with several utility methods that prevent the need to reach out to the global tableau object.
- Source:
Methods
(static) getUsername() → {string}
Extension of the web data connector API that gets the connection username.
- Source:
Returns:
The username associated with this connection.
- Type
- string
ajaxErrorHandler(jqXHR, textStatus, errThrown)
A generic error handler that can be used by implementors for simplicity.
Parameters:
Name | Type | Description |
---|---|---|
jqXHR |
Object | |
textStatus |
string | |
errThrown |
string |
- Source:
getAuthPurpose() → {string}
Helper method used to determine whether or not authentication is being attempted for an ad-hoc query (Desktop) or in an automated context (Server). Useful when dealing with restrictive oauth providers.
- Source:
Returns:
The authentication purpose. One of:
- ephemeral: when the user is authenticating with Tableau Desktop.
- enduring: when authentication is being performed on Server.
- Type
- string
getConnectionData(keynullable) → {Object|string}
Extension of the web data connector API that handles complex connection data getting for the implementor.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string |
<nullable> |
An optional key to return an individual connection detail. If no key is provided, all connection details will be returned. |
- Source:
- See:
-
- connector.setConnectionData
Returns:
An object representing connection data. Keys are assumed to be form input names; values are assumed to be form input values. If a key was provided as, an individual connection detail will be returned as a string.
- Type
- Object | string
getPassword() → {string}
Extension of the web data connector API that gets the connection password.
- Source:
Returns:
The password associated with this connection.
- Type
- string
promiseErrorHandler(e)
Generic error handler that can be passed to any Promise error handler.
Parameters:
Name | Type | Description |
---|---|---|
e |
- Source:
registerDataRetrieval(tableId, promise) → {Promise}
Registers a promise with the connector for a particular table's data. This promise can be read from and chained via the waitForData method.
Parameters:
Name | Type | Description |
---|---|---|
tableId |
string | The ID of the table for which the given promise is being registered. |
promise |
Promise | The promise returned by the data retrieval callback associated with this table. |
- Source:
- See:
Returns:
- Type
- Promise
setConnectionData(data) → {Object}
Extension of the web data connector API that handles complex connection data setting for the implementor.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The data that's intended to be set for this connection. Keys are assumed to be form input names; values are assumed to be form input values. |
- Source:
- See:
-
- connector.getConnectionData
Returns:
Returns the data that was set.
- Type
- Object
setPassword(password) → {string}
Extension of the web data connector API that sets the connection password.
Parameters:
Name | Type | Description |
---|---|---|
password |
string | The password or other sensitive connection information to be associated with this connection. The value is encrypted and stored by tableau. |
- Source:
Returns:
The password now associated with this connection.
- Type
- string
setUsername(username) → {string}
Extension of the web data connector API that sets the connection username.
Parameters:
Name | Type | Description |
---|---|---|
username |
string | The username to be associated with this connection. |
- Source:
Returns:
The username now associated with this connection.
- Type
- string
waitForData(tableId) → {Promise}
Returns a promise that resolves when data collection for the given table completes. The promise will resolve with the full set of data returned for the given table.
Parameters:
Name | Type | Description |
---|---|---|
tableId |
string | The ID of the table whose data you are waiting for. |
- Source:
- See:
Throws:
An error if no data retrieval promise has been registered for the given table.
Returns:
- Type
- Promise
Example
connector.waitForData('independentTable')
.then(function (independentTableData) {
// Do things based on the independentTable's data here.
});