Use table and table-valued function templates
- Last UpdatedFeb 10, 2023
- 2 minute read
- PI System
- PI SQL Commander Lite 2021
- Developer
The Element and EventFrame schema in the Master catalog of PI SQL Client each provide a template for the Value table and templates for table-valued functions.

To use a template for creating a view or a table-valued function, do the following:
-
In the Element or EventFrame schema, expand the Templates folder and then right-click Value or one of the table-valued functions.
Depending on if you selected to create a view or a table-valued function, you will need to do the following:
-
Click Scripts > CREATE VIEW > New Query Editor Window.
-
Click Scripts > CREATE FUNCTION > New Query Editor Window.
The template query will be displayed in the Query Editor pane.
-
-
In the Query Editor pane, substitute <catalog>, <schema>, and <view> or <function> with their name.
-
Substitute the parameters with their values.
Optional parameters are commented with --Optional.
Blank Value view template

Value view template with parameters substituted

Note: TemplateAttributePath and ValueColumnName must always be set. Other column name parameters may be omitted or set to null which removes the columns from the result. If DesiredUOM is omitted or set to null, the default unit of measure is used.
-
Press F5 to execute the query.