AddColumnToDataSource

Adds an in-memory column to an existing data source. Columns created with this function will only persist until the end of the current session.

Syntax

AddColumnToDataSource( DataSourceName, ColumnName, ColumnType, DefaultValue, Expression, ModelReference, ColumnAlias );

Parameters

Parameter Name Type Description Optional? Default Value
DataSourceName String The name of the data source to which the column should be added. No n/a
ColumnName String The name to give the column. No n/a
ColumnType String The type of data the column will contain. This could be set to "String", "Integer", "Decimal", "Double", "Boolean", "DateTime", or "Derived Expression". No n/a
DefaultValue String The column's default value, which will be applied if no other value is specified. Yes ""
Expression String A filter expression that will be used to modify the value displayed in the column. This allows for dynamically computed column values, and can contain keywords, including names of other columns in the data source. Yes ""
ModelReference String The model reference associated with the chosen in-memory data source. If the function is called by a model, it assumes the data source exists within that model, so you do not need to specify a reference unless the data source exists in a different model on the same repository. If the function is called outside the context of a model - for example, in a web page expression or via the DATASOURCE element tag - you must specify the model containing the data source. Yes ""
ColumnAlias String An alias keyword to use for the column. This works the same way as a standard data source alias, so it should match a keyword whose value should be stored in the column. If this is not used, the ColumnName will be set as the alias. Yes ""

Output

If successful, the function will return an empty string; otherwise, it will return an error message.