Data Views
Users can add data views in AnalytiX-BI to define pre-built queries of the defined data tables.
To Add a Data View:
-
Open the Workbench, then expand AnalytiX, then BI Server, then Data Models (and, optionally, a data model folder), then select Add Data View as shown below.
Add Data View from Project Explorer
-OR-
Select a data model or data model folder, then select Add Data View, shown below, in the Edit section of the Home ribbon in the Workbench.
Add Data View Button
-
This opens the New Data View Properties window shown below.
New Data View Properties
Enter a name in the Data View Name field.
A data view in AnalytiX-BI is essentially a named query, which can then be referenced by name in runtime. For example, we can create a data view in the default Northwind data model to only show orders placed by the customer with ID "ALFKI".
Creating a Data View in a Data Model
Once the view’s query is entered, click the Click to test query link to run the query. The results will be displayed in a popup window. If the query fails, details about the error will be displayed below the query.
Previewing a Data View’s results
Note: Queries from Data views can reference tables or other views, but only from the same data model.
AnalytiX-BI allows to use parameters in the query text wherever a column reference or expression can be used. For example, we can parameterize the value ALFKI in our query.
Parametrizing a Data View query
At this point, we can switch to the Parameters tab.
Configuring a Data View’s parameters
AnalytiX-BI requires that all the parameters used in the query are defined under the Parameters tab. Parameters can be created manually or automatically detected from the query text by clicking the Click to update the parameters link.
Detecting a Data View’s parameters
Note: all automatically detected parameters are added with type String. The data type should be updated manually to reflect the actual parameter type to avoid implicit casts when the query is executed.
Once the parameters are defined, the query can be tested as we did above. Before executing the query, Workbench will ask for the parameter values.
Entering parameter values before executing the query
Clicking the Next button will then execute the query.
Previewing the Data View’s results
Parameterized views can be used in other queries by passing the parameter values in parenthesis. Values can be either named or unnamed, in which case they will be bound to the view parameters positionally.
Passing unnamed parameters to a parameterized Data View
Passing named parameters to a parameterized Data View
Note: For more details on how to write a query for AnalytiX-BI, refer to the the AnalytiX-BI SQL Language page.
Data views themselves are entirely virtual and not cached. However, the result of a data view query may be cached. The view’s query result is not cached if the view is used in another view. For example, if you access a view named InnerView with this query:
SELECT InnerView.CategoryName
The results of OuterView will be cached, but the results of InnerView will not be.
See Performance Considerations > Query Execution for more information about query caching.
See Also: