Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Asset Framework and PI System Explorer (PI Server 2018)

Add table parameters to a linked table query

  • Last UpdatedJan 11, 2023
  • 1 minute read

As you define a linked table in the Table Link window, you can add parameters to the table query and set default values for them.

  1. Edit the text in the Query box to include the new parameter(s).

    Parameter names must begin with the @ character.

  2. Click inside the Parameters table to display the new parameters from the query.

  3. Enter default values for each parameter to determine the default results from the query and click OK.

    After you have added parameters to the query, you can specify values for them as you configure a table lookup data reference that uses the linked table.

Example

Consider the following query for a linked table named MyTable. The WHERE clause limits the selection from an external table (BigTable) to those rows with a particular RowID:

SELECT * FROM BigTable WHERE RowID = 101

Replace the fixed value 101 with a table query parameter @id (note that query parameter names must begin with the @ character):

SELECT * FROM BigTable WHERE RowID = @id

Now, for every table lookup data reference that uses MyTable, you can supply different table parameter values for @id to get different results from the query.

For example, in the Table Lookup Data Reference window, as you configure a data reference, enter @AssetID for the value of @id in the Table Parameters list. This sets @id to the current value of the attribute AssetID. The corresponding query for this would be:

SELECT Result FROM MyTable; @id=@AssetId

This query returns rows whose RowID matches the current value of AssetID.

TitleResults for “How to create a CRG?”Also Available in