Adaptive Data Source
ai.dataSource
The data source contains settings and tables.
Functions
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getTables() |
Array<ai.dataSource.table> |
Returns a list of imported tables. |
|
getTable( tableId ) |
tableId : String |
ai.dataSource.table |
Returns the table with requested table id. Returns null if no table is found. |
getSettings() |
Array<ai.dataSource.setting> |
Returns all flexible settings. |
|
getSetting( displayName ) |
displayName : String |
ai.dataSource.setting |
Returns a flexible setting by its display name |
Example
function previewData(context) { var dataSource = context.getDataSource(); var allTablesInThisDataSource = dataSource.getTables(); }
ai.dataSource.table
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getColumnByDisplayName( name ) |
name : String |
ai.dataSource.column |
Finds a column by its display name. Returns null if no column found. |
getColumnById( id ) |
id : String |
ai.dataSource.column |
Finds a column by its remote Id. Returns null if no column found. |
getColumns() |
Array<ai.dataSource.column> |
Returns all child columns that have been enabled for data import. |
|
getDisplayName() |
String |
Returns the display name of the table. |
|
getId() |
String |
Returns the remote Id of this table, or display name is no remote Id was specified. |
|
getLastImportedgetLastImported() |
String |
Returns a string identifying when the table was last imported. |
|
getRelationships() |
Array<ai.dataSource.relationship> |
Returns all relationships where this table is the primary table of the relationship. |
|
getRequiredParameters() |
Array<ai.dataSource.table.requiredParameter> |
Returns all table required parameters and their parameter values. |
|
getRequiredParameter( id ) |
id : String |
ai.dataSource.table.requiredParameter |
Returns a table required parameter by its remote Id. |
ai.dataSource.table.column
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getColumnType() |
String |
Returns the column type. Value is either 'DateTimeColumn', 'IntegerColumn', 'FloatColumn', 'BooleanColumn' or 'TextColumn'. |
|
getDisplayName() |
String |
Returns the columns' display name. |
|
getDisplayOrder() |
String |
Returns the columns' display order. |
|
getId() |
String |
Returns the columns remote Id, or display name is no remote Id was specified. |
|
getIncludeByDefault() |
Boolean |
Returns true if the column is included in the data import. |
|
getIncludeInKey() |
Boolean |
Returns true if the column is part of the table key. Key columns do not allow null values. |
|
getLength() |
Integer |
Note: Only for TextColumns. Returns the max length of values held in a TextColumn. |
|
getMandatoryForImports() |
True |
Returns true if the column is required to be part of the data import. |
|
getNonFilterable() |
True |
Returns true if the column cannot be used as part of a SQL filter (WHERE statement). |
|
getRemoteColumnType() |
String |
Returns the columns' remote column type as defined in the import structure script. |
ai.dataSource.table.relationship
Functions
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getJoinExpression() |
String |
Returns the relationships' expression storage SQL e.g. 'P.Column123 = R.Column321'. |
|
getJoinType() |
Int |
Returns the relationships' type of join. Values are either 0 (Inner), 1 (LeftOuter) or 2 (RightOuter). |
|
getDisplayName() |
String |
Returns the relationships' display name. |
|
getRelatedTableId() |
String |
Returns the remote Id of the relationships' related table, or its display name is no remote Id was specified. |
|
getRelatedTableName() |
String |
Returns the display name of the relationships' related table. |
ai.dataSource.setting
Flexible settings are child items of a Custom Cloud Data Source. Settings can be static in that a value is configured, or they can be parameterized in that at script runtime, users are prompted to enter in a value for the setting. Examples of setting usage are urls, usernames, passwords, date ranges or dimensions that a script can access.
Functions
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getDisplayName() |
String |
Returns the settings' display name. |
|
getValue() |
Mixed |
Returns the value of the setting's parameter. Value may be a primitive type or complex object - see Value Types below. |
|
isBoolean() |
Boolean |
Returns true if the setting type is Boolean. |
|
isDimension() |
Boolean |
Returns true if the setting type is Dimension. |
|
isInteger() |
Boolean |
Returns true if the setting type is Integer. |
|
isPassword() |
Boolean |
Returns true if the setting type is Password. |
|
isPeriodRange() |
Boolean |
Returns true if the setting type is PeriodRange. |
|
isText() |
Boolean |
Returns true if the setting type is Text. |
Value Types
Each setting's getValue() function can return a primitive type or a complex object.
Boolean Settings
getValue() returns the value as a Boolean.
Text Settings
getValue() returns the value as a String.
Integer Settings
getValue() returns the value as an Integer.
Password Settings
getValue() returns the value as a String.
Period Range Settings
getValue() returns the value as a complex object. This object is defined as such:
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getFromPeriod() |
String |
Returns a string defining the internal representation of resolved Adaptive From Period that can be used to pass to the ai.calendar method calls. E.g. "3152|5201611100000" |
|
getToPeriod() |
String |
Returns a string defining the internal representation of resolved Adaptive To Period that can be used to pass to the ai.calendar method calls. E.g. "3152|5201611100000" |
|
getFromPeriodStartDateTime() |
String |
Returns a datetime string representation of the From Period start datetime, expressed in local time. E.g. "2016-01-01T00:00:00+10:00" |
|
getFromPeriodEndDateTime() |
String |
Returns a datetime string representation of the From Period end datetime, expressed in local time. E.g. "2016-02-01T00:00:00+10:00" |
|
getToPeriodStartDateTime() |
String |
Returns a datetime string representation of the To Period start datetime, expressed in local time. E.g. "2016-06-01T00:00:00+10:00" |
|
getToPeriodEndDateTime() |
String |
Returns a datetime string representation of the To Period end datetime, expressed in local time. E.g. "2016-07-01T00:00:00+10:00" |
Dimension Settings
getValue() returns the value as a complex object. This object is defined as such:
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getDimensionName() |
String |
Returns the name of the Dimension defined in the value. |
|
getValueName() |
Mixed |
Returns the name of the Dimension Member defined in the value. |
Example
var setting = context.getDataSource().getSetting('setting name'); var name = setting.getDisplayName(); var value = setting.getValue(); // DataType checkup for the setting. setting.isPeriodRange(), setting.isInteger(), setting.isBoolean(), setting.isText(), setting.isPassword(), setting.isDimension();
ai.dataSource.table.requiredParameter
During script execution, valid Required Parameters prompt a user to provide values. These values are then accessible in scripts. Required Parameters can be created during importStructure.
During ImportData, only Required Parameters that have been configurable as setForDataImport(true) are accessible in the script.
Functions
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getId() |
String |
Returns the required parameter's remote Id. |
|
getValue() |
Mixed |
Returns the value of the required parameter's parameter. Value may be a primitive type or complex object - see Value Types below. |
|
isBoolean() |
Boolean |
Returns true if the required parameter's type is Boolean. |
|
isDimension() |
Boolean |
Returns true if the required parameter's type is Dimension. |
|
isInteger() |
Boolean |
Returns true if the required parameter's type is Integer. |
|
isPassword() |
Boolean |
Returns true if the required parameter's type is Password. |
|
isPeriodRange() |
Boolean |
Returns true if the required parameter's type is PeriodRange. |
|
isText() |
Boolean |
Returns true if the required parameter's type is Text. |
Value Types
Each required parameter's getValue() function can return a primitive type or a complex object.
Boolean Required Parameters
getValue() returns the value as a Boolean.
Text Required Parameters
getValue() returns the value as a String.
Integer Required Parameters
getValue() returns the value as an Integer.
Password Required Parameters
getValue() returns the value as a String.
Period Range Required Parameters
getValue() returns the value as a complex object. This object is defined as such:
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getFromPeriod() |
String |
Returns a string defining the resolved Adaptive From Period. E.g. "Month y2016 M1" |
|
getToPeriod() |
String |
Returns a string defining the resolved Adaptive To Period. E.g. "Month y2016 M1" |
|
getFromPeriodStartDateTime() |
String |
Returns a datetime string representation of the From Period start datetime, expressed in local time. E.g. "2016-01-01T00:00:00+10:00" |
|
getFromPeriodEndDateTime() |
String |
Returns a datetime string representation of the From Period end datetime, expressed in local time. E.g. "2016-02-01T00:00:00+10:00" |
|
getToPeriodStartDateTime() |
String |
Returns a datetime string representation of the To Period start datetime, expressed in local time. E.g. "2016-06-01T00:00:00+10:00" |
|
getToPeriodEndDateTime() |
String |
Returns a datetime string representation of the To Period end datetime, expressed in local time. E.g. "2016-07-01T00:00:00+10:00" |
Dimension Settings
getValue() returns the value as a complex object. This object is defined as such:
Method |
Parameters |
Returns |
Description |
---|---|---|---|
getDimensionName() |
String |
Returns the name of the Dimension defined in the value. |
|
getValueName() |
Mixed |
Returns the name of the Dimension Member defined in the value. |