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:

  1. Open the Expression Editor where you want to add the expression.
  2. Enter the following:

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

  1. Replace DataSourceName with the keyword for the data source to use.
  2. Replace ColumnName with the name to give the new column.
  3. 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".
  4. (Optional) Replace DefaultValue with a default value that will be applied if no other is specified when new data is saved.
  5. (Optional) Replace Expression with a filter expression used to modify the data in the column.
  6. (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.
  7. (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.
  8. Repeat steps 2-9 to add more columns if required.
  9. Save the expression.