Concepts → Materialized View Formula Column
About a materialized view formula column
A materialized view formula column contains a formula expression that returns a scalar value of a specific data type and functions as either a measure or a dimension. During a load job, the Loader Service processes the formula expression and persists the returned values to shared storage. To define the formula expression of a formula column, you use the Formula Builder.
Properties of a materialized view formula column
Following are the properties of a materialized view formula column:
Property | Control | Description |
---|---|---|
Show in Analyzer | checkbox | Select this property to show the column as selectable in the Data Panel |
Name | text box | The column’s name; used in the fully qualified name of the column |
Label | text box | A user friendly name |
Type | read only | The data type of the column. The data type of a column in a materialized view is determined by the formula result. |
Function | drop down list | Select the Incorta Function of the column |
Type inference
Based on the output of the formula expression, the Table Editor will automatically infer the data type of a formula column. You can modify the formula expression to explicitly cast the data type of the return value. For example, you can use a built-in function such as int()
to specify that the formula expression returns an integer value.
Some databases such as SQL Server will store a time component for a column of the type DATE
. For this reason, Incorta will infer a Timestamp data type for a database DATE column.
Function
A materialized view formula column can be used as a dimension or a measure.
Function: Dimension
A dimension categorizes, describes, or groups data. Examples of a dimension column are State, Year, or City. Dimension columns do not require unique values.
A dimension column has an associated behavior in the Analyzer. When you double-click a dimension column in the Data panel, the Analyzer automatically adds the column to the Grouping Dimension tray in the Insight panel.
Function: Measure
A measure is a measurement of data. Examples of a measure column are Revenue, Quantity, and Cost.
A measure column has an associated behavior in the Analyzer. When you double-click a measure column in the Data panel, the Analyzer automatically adds the column to the Measure tray in the Insight panel.
Formula expression for a materialized view formula column
A formula expression returns a scalar value or array of values. These values are of a specific type. A formula expression can consist of built-in functions, date system variables, and referenceable columns.
Available built-in functions
There are several groups of built-in functions available for use in a formula expression for a materialized view formula column. All functions return a scalar value:
Function Type | Description |
---|---|
Boolean | Evaluates to True or False |
Conditional Statement | Returns a value based on the evaluation of a parameter |
Conversion | Converts the Incorta Data Type of a parameter. In addition, functions that manipulate Timestamp and Date values for different return values. |
Miscellaneous | Assorted uses |
Arithmetic | Takes one or more values and return a single value |
Date | Manipulates Timestamp and Date values |
String | Returns string values or return values based on string parameters |
Date system variables
Only date system variables are supported for use in a materialized view formula column.
If you reference the $user
variable or a session variable in a materialized view formula column, you will encounter either a validation or load error.
Referenceable columns
A referenceable column has a fully qualified name. A referenceable column can be a data-backed column or formula column. A materialized view formula column is evaluated during a load job.
A materialized view will not inherit joins from its queried source columns. A materialized view formula column’s possible reference options are bound by the child join relationships of the materialized view. If the materialized view is not the child in any join relationship, the only columns that can be used in a materialized view formula column are the materialized view’s existing columns.
Following are the possible types of referenceable columns in a materialized view formula column:
Table or View Type | Column Type | Referenceable | Note |
---|---|---|---|
Alias | Data-backed column | Yes | |
Alias | Formula column | Yes | |
Business Schema View | Data-backed column | No | |
Business Schema View | Formula column | No | |
Incorta Analyzer Table | Data-backed column | Yes | |
Incorta Analyzer Table | Formula column | Yes | |
Incorta SQL Table | Data-backed column | Yes | The Incorta SQL Table is an Incorta Labs feature and is enabled in the CMC. |
Incorta Analyzer View | Data-backed column | No | |
Incorta Analyzer View | Formula column | No | |
Materialized View | Data-backed column | Yes | |
Materialized View | Formula column | Yes | |
Physical Schema Table | Data-backed column | Yes | |
Physical Schema Table | Formula column | Yes |
A load job will reveal an error for a non-validated formula expression for a physical schema table formula column.
A materialized view formula column cannot reference an Incorta Analyzer table column or Incorta SQL table column that references a business schema view.
When using system variables in the physical schema, the system variable’s value is only calculated on a schema load. Take this into account when using them in any aspect of your physical schema.