Adding an In-Memory Column to a Data Source
You can add a temporary in-memory column to a data source at any time using the AddColumnToDataSource function. When this function runs it will add a new column, which will only persist until the end of the current session.
This can be used to create the structure of an in-memory data source, but can be used to add temporary columns to a standard data source as well.
Implementation:
- Open the Expression Editor where you want to add the expression.
- Enter the following:
AddColumnToDataSource( DataSourceName, ColumnName, ColumnType, DefaultValue, Expression, ModelReference, ColumnAlias );
- Replace DataSourceName with the keyword for the data source to use.
- Replace ColumnName with the name to give the new column.
- Replace ColumnType with a string representing the type of data the column should hold. This can be either "String", "Integer", "Decimal", "Double", "Boolean", "DateTime", or "Derived Expression".
- (Optional) Replace DefaultValue with a default value that will be applied if no other is specified when new data is saved.
- (Optional) Replace Expression with a filter expression used to modify the data in the column.
- (Optional) Replace ModelReference with the reference for the model associated with the data source. This is only required if this function is called outside the context of a model, such as in a web page expression.
- (Optional) Replace ColumnAlias with an alias keyword to give the column. If this is not used, the column name will be used as the alias.
- Repeat steps 2-9 to add more columns if required.
- Save the expression.