DataModelConnection

DataModelConnection class

Specifies a data model connection

class DataModelConnection extends ExternalConnection;

Constructors

NameDescription
constructor(ExternalConnection)Constructs from a parent object convertible to this.

Methods

MethodDescription
getClassType()Gets the type of this ExternalConnection object.
getCommand()The string containing the database command to pass to the data provider API that will interact with the external source in order to retrieve data
setCommand(string)The string containing the database command to pass to the data provider API that will interact with the external source in order to retrieve data
getCommandType()Returns OLEDBCommandType type.
setCommandType(OLEDBCommandType)Returns OLEDBCommandType type.
getConnectionString()The connection information string is used to make contact with an OLE DB or ODBC data source.
setConnectionString(string)The connection information string is used to make contact with an OLE DB or ODBC data source.
isNull()Checks whether the implementation object is null.
getId()Gets the id of the connection.
getConnectionId()Specifies The unique identifier of this connection.
getSourceType()Gets or Sets the external connection DataSource type.
setSourceType(ConnectionDataSourceType)Gets or Sets the external connection DataSource type.
getSSOId()Identifier for Single Sign On (SSO) used for authentication between an intermediate spreadsheetML server and the external data source.
setSSOId(string)Identifier for Single Sign On (SSO) used for authentication between an intermediate spreadsheetML server and the external data source.
getSavePassword()True if the password is to be saved as part of the connection string; otherwise, False.
setSavePassword(boolean)True if the password is to be saved as part of the connection string; otherwise, False.
getSaveData()True if the external data fetched over the connection to populate a table is to be saved with the workbook; otherwise, false.
setSaveData(boolean)True if the external data fetched over the connection to populate a table is to be saved with the workbook; otherwise, false.
getRefreshOnLoad()True if this connection should be refreshed when opening the file; otherwise, false.
setRefreshOnLoad(boolean)True if this connection should be refreshed when opening the file; otherwise, false.
getReconnectionMethodType()Specifies what the spreadsheet application should do when a connection fails. The default value is ReConnectionMethodType.Required.
setReconnectionMethodType(ReConnectionMethodType)Specifies what the spreadsheet application should do when a connection fails. The default value is ReConnectionMethodType.Required.
getOnlyUseConnectionFile()Indicates whether the spreadsheet application should always and only use the connection information in the external connection file indicated by the odcFile attribute when the connection is refreshed. If false, then the spreadsheet application should follow the procedure indicated by the reconnectionMethod attribute
setOnlyUseConnectionFile(boolean)Indicates whether the spreadsheet application should always and only use the connection information in the external connection file indicated by the odcFile attribute when the connection is refreshed. If false, then the spreadsheet application should follow the procedure indicated by the reconnectionMethod attribute
getOdcFile()Specifies the full path to external connection file from which this connection was created. If a connection fails during an attempt to refresh data, and reconnectionMethod=1, then the spreadsheet application will try again using information from the external connection file instead of the connection object embedded within the workbook.
setOdcFile(string)Specifies the full path to external connection file from which this connection was created. If a connection fails during an attempt to refresh data, and reconnectionMethod=1, then the spreadsheet application will try again using information from the external connection file instead of the connection object embedded within the workbook.
getSourceFile()Used when the external data source is file-based. When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file. May be expressed in URI or system-specific file path notation.
setSourceFile(string)Used when the external data source is file-based. When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file. May be expressed in URI or system-specific file path notation.
isNew()True if the connection has not been refreshed for the first time; otherwise, false. This state can happen when the user saves the file before a query has finished returning.
setIsNew(boolean)True if the connection has not been refreshed for the first time; otherwise, false. This state can happen when the user saves the file before a query has finished returning.
getName()Specifies the name of the connection. Each connection must have a unique name.
setName(string)Specifies the name of the connection. Each connection must have a unique name.
getKeepAlive()True when the spreadsheet application should make efforts to keep the connection open. When false, the application should close the connection after retrieving the information.
setKeepAlive(boolean)True when the spreadsheet application should make efforts to keep the connection open. When false, the application should close the connection after retrieving the information.
getRefreshInternal()Specifies the number of minutes between automatic refreshes of the connection.
setRefreshInternal(number)Specifies the number of minutes between automatic refreshes of the connection.
getConnectionDescription()Specifies the user description for this connection
setConnectionDescription(string)Specifies the user description for this connection
isDeleted()Indicates whether the associated workbook connection has been deleted. true if the connection has been deleted; otherwise, false.
setIsDeleted(boolean)Indicates whether the associated workbook connection has been deleted. true if the connection has been deleted; otherwise, false.
getCredentialsMethodType()Specifies the authentication method to be used when establishing (or re-establishing) the connection.
setCredentialsMethodType(CredentialsMethodType)Specifies the authentication method to be used when establishing (or re-establishing) the connection.
getBackgroundRefresh()Indicates whether the connection can be refreshed in the background (asynchronously). true if preferred usage of the connection is to refresh asynchronously in the background; false if preferred usage of the connection is to refresh synchronously in the foreground.
setBackgroundRefresh(boolean)Indicates whether the connection can be refreshed in the background (asynchronously). true if preferred usage of the connection is to refresh asynchronously in the background; false if preferred usage of the connection is to refresh synchronously in the foreground.
getParameters()Gets ConnectionParameterCollection for an ODBC or web query.
getPowerQueryFormula()Gets the definition of power query formula.
getConnectionFile()Gets the connection file.
getSecondCommand()Specifies a second command text string that is persisted when PivotTable server-based page fields are in use. For ODBC connections, serverCommand is usually a broader query than command (no WHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand), parameter UI can be populated and parameterized queries can be constructed
setSecondCommand(string)Specifies a second command text string that is persisted when PivotTable server-based page fields are in use. For ODBC connections, serverCommand is usually a broader query than command (no WHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand), parameter UI can be populated and parameterized queries can be constructed

constructor(ExternalConnection)

Constructs from a parent object convertible to this.

constructor(obj: ExternalConnection);

Parameters:

ParameterTypeDescription
objExternalConnectionThe parent object.

getClassType()

Gets the type of this ExternalConnection object.

getClassType() : ExternalConnectionClassType;

Returns

ExternalConnectionClassType

getCommand()

The string containing the database command to pass to the data provider API that will interact with the external source in order to retrieve data

getCommand() : string;

setCommand(string)

The string containing the database command to pass to the data provider API that will interact with the external source in order to retrieve data

setCommand(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getCommandType()

Returns OLEDBCommandType type.

getCommandType() : OLEDBCommandType;

Returns

OLEDBCommandType

setCommandType(OLEDBCommandType)

Returns OLEDBCommandType type.

setCommandType(value: OLEDBCommandType) : void;

Parameters:

ParameterTypeDescription
valueOLEDBCommandTypeThe value to set.

getConnectionString()

The connection information string is used to make contact with an OLE DB or ODBC data source.

getConnectionString() : string;

setConnectionString(string)

The connection information string is used to make contact with an OLE DB or ODBC data source.

setConnectionString(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

isNull()

Checks whether the implementation object is null.

isNull() : boolean;

getId()

Gets the id of the connection.

getId() : number;

getConnectionId()

Specifies The unique identifier of this connection.

getConnectionId() : number;

Remarks

NOTE: This property is now obsolete. Instead, please use ExternalConnection.Id property. This property will be removed 12 months later since October 2024. Aspose apologizes for any inconvenience you may have experienced.

getSourceType()

Gets or Sets the external connection DataSource type.

getSourceType() : ConnectionDataSourceType;

Returns

ConnectionDataSourceType

setSourceType(ConnectionDataSourceType)

Gets or Sets the external connection DataSource type.

setSourceType(value: ConnectionDataSourceType) : void;

Parameters:

ParameterTypeDescription
valueConnectionDataSourceTypeThe value to set.

getSSOId()

Identifier for Single Sign On (SSO) used for authentication between an intermediate spreadsheetML server and the external data source.

getSSOId() : string;

setSSOId(string)

Identifier for Single Sign On (SSO) used for authentication between an intermediate spreadsheetML server and the external data source.

setSSOId(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getSavePassword()

True if the password is to be saved as part of the connection string; otherwise, False.

getSavePassword() : boolean;

setSavePassword(boolean)

True if the password is to be saved as part of the connection string; otherwise, False.

setSavePassword(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getSaveData()

True if the external data fetched over the connection to populate a table is to be saved with the workbook; otherwise, false.

getSaveData() : boolean;

setSaveData(boolean)

True if the external data fetched over the connection to populate a table is to be saved with the workbook; otherwise, false.

setSaveData(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getRefreshOnLoad()

True if this connection should be refreshed when opening the file; otherwise, false.

getRefreshOnLoad() : boolean;

setRefreshOnLoad(boolean)

True if this connection should be refreshed when opening the file; otherwise, false.

setRefreshOnLoad(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getReconnectionMethodType()

Specifies what the spreadsheet application should do when a connection fails. The default value is ReConnectionMethodType.Required.

getReconnectionMethodType() : ReConnectionMethodType;

Returns

ReConnectionMethodType

setReconnectionMethodType(ReConnectionMethodType)

Specifies what the spreadsheet application should do when a connection fails. The default value is ReConnectionMethodType.Required.

setReconnectionMethodType(value: ReConnectionMethodType) : void;

Parameters:

ParameterTypeDescription
valueReConnectionMethodTypeThe value to set.

getOnlyUseConnectionFile()

Indicates whether the spreadsheet application should always and only use the connection information in the external connection file indicated by the odcFile attribute when the connection is refreshed. If false, then the spreadsheet application should follow the procedure indicated by the reconnectionMethod attribute

getOnlyUseConnectionFile() : boolean;

setOnlyUseConnectionFile(boolean)

Indicates whether the spreadsheet application should always and only use the connection information in the external connection file indicated by the odcFile attribute when the connection is refreshed. If false, then the spreadsheet application should follow the procedure indicated by the reconnectionMethod attribute

setOnlyUseConnectionFile(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getOdcFile()

Specifies the full path to external connection file from which this connection was created. If a connection fails during an attempt to refresh data, and reconnectionMethod=1, then the spreadsheet application will try again using information from the external connection file instead of the connection object embedded within the workbook.

getOdcFile() : string;

setOdcFile(string)

Specifies the full path to external connection file from which this connection was created. If a connection fails during an attempt to refresh data, and reconnectionMethod=1, then the spreadsheet application will try again using information from the external connection file instead of the connection object embedded within the workbook.

setOdcFile(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getSourceFile()

Used when the external data source is file-based. When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file. May be expressed in URI or system-specific file path notation.

getSourceFile() : string;

setSourceFile(string)

Used when the external data source is file-based. When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file. May be expressed in URI or system-specific file path notation.

setSourceFile(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

isNew()

True if the connection has not been refreshed for the first time; otherwise, false. This state can happen when the user saves the file before a query has finished returning.

isNew() : boolean;

setIsNew(boolean)

True if the connection has not been refreshed for the first time; otherwise, false. This state can happen when the user saves the file before a query has finished returning.

setIsNew(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getName()

Specifies the name of the connection. Each connection must have a unique name.

getName() : string;

setName(string)

Specifies the name of the connection. Each connection must have a unique name.

setName(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getKeepAlive()

True when the spreadsheet application should make efforts to keep the connection open. When false, the application should close the connection after retrieving the information.

getKeepAlive() : boolean;

setKeepAlive(boolean)

True when the spreadsheet application should make efforts to keep the connection open. When false, the application should close the connection after retrieving the information.

setKeepAlive(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getRefreshInternal()

Specifies the number of minutes between automatic refreshes of the connection.

getRefreshInternal() : number;

setRefreshInternal(number)

Specifies the number of minutes between automatic refreshes of the connection.

setRefreshInternal(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

getConnectionDescription()

Specifies the user description for this connection

getConnectionDescription() : string;

setConnectionDescription(string)

Specifies the user description for this connection

setConnectionDescription(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

isDeleted()

Indicates whether the associated workbook connection has been deleted. true if the connection has been deleted; otherwise, false.

isDeleted() : boolean;

setIsDeleted(boolean)

Indicates whether the associated workbook connection has been deleted. true if the connection has been deleted; otherwise, false.

setIsDeleted(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getCredentialsMethodType()

Specifies the authentication method to be used when establishing (or re-establishing) the connection.

getCredentialsMethodType() : CredentialsMethodType;

Returns

CredentialsMethodType

setCredentialsMethodType(CredentialsMethodType)

Specifies the authentication method to be used when establishing (or re-establishing) the connection.

setCredentialsMethodType(value: CredentialsMethodType) : void;

Parameters:

ParameterTypeDescription
valueCredentialsMethodTypeThe value to set.

getBackgroundRefresh()

Indicates whether the connection can be refreshed in the background (asynchronously). true if preferred usage of the connection is to refresh asynchronously in the background; false if preferred usage of the connection is to refresh synchronously in the foreground.

getBackgroundRefresh() : boolean;

setBackgroundRefresh(boolean)

Indicates whether the connection can be refreshed in the background (asynchronously). true if preferred usage of the connection is to refresh asynchronously in the background; false if preferred usage of the connection is to refresh synchronously in the foreground.

setBackgroundRefresh(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getParameters()

Gets ConnectionParameterCollection for an ODBC or web query.

getParameters() : ConnectionParameterCollection;

Returns

ConnectionParameterCollection

getPowerQueryFormula()

Gets the definition of power query formula.

getPowerQueryFormula() : PowerQueryFormula;

Returns

PowerQueryFormula

getConnectionFile()

Gets the connection file.

getConnectionFile() : string;

getSecondCommand()

Specifies a second command text string that is persisted when PivotTable server-based page fields are in use. For ODBC connections, serverCommand is usually a broader query than command (no WHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand), parameter UI can be populated and parameterized queries can be constructed

getSecondCommand() : string;

setSecondCommand(string)

Specifies a second command text string that is persisted when PivotTable server-based page fields are in use. For ODBC connections, serverCommand is usually a broader query than command (no WHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand), parameter UI can be populated and parameterized queries can be constructed

setSecondCommand(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.