Create a connection using the Trendview Business Logic Tier (BLT)
- Last UpdatedApr 24, 2025
- 5 minute read
This section will take you through the process of creating a connection to the Trendview Business Logic Tier (BLT). this BLT is used to obtain data from both the RealTime database (RTDB) and Historical database. The following example illustrates how to create a connection to the Historical database using the Trendview BLT.
To create a connection to the Historical database
-
Open your Microsoft Visual Studio project.

-
Right-click the report, and select New Item > Add.
The Add New Item window for the report appears.

-
In the Add New Item window:
-
In the left pane, select Report Project as a project template type.
-
Select Report Wizard.
-
Enter the name of your report in the Name field.
-
Select Add.
The Report Wizard opens.

-
-
Select Next.
The Select the Data Source page appears.

-
In the Select the Data Source page:
-
Select New data source.
-
In the Name field, enter the name of the new data source.
-
In the Type field, select the type of new data source.
-
Select Edit.
The Change Data Source dialog box appears.
-
-
Select Microsoft SQL Server (SqlClient), and select OK.
The Connection Properties dialog box appears.

-
In the Connection Properties dialog box:
-
In the Server name field, enter the name of the server that you want to connect to.
-
Select Select or enter a database name, and enter or choose the database you want to connect to.
-
Select OK.
The Connection Properties dialog box closes and the Select the Data Source page appears again, this time with the Connection string window populated.

-
-
Select Next.
The Design the Query page appears.

-
Select Query Builder.
The Query Designer window opens.

-
Using the "Trending Functions" table at the bottom of this section as a guide, enter the desired trending function in the Query Designer window.
-
In the Query Designer window:
-
Select the SQL check icon.
-
Select OK.

The Query Designer window closes and the Design the Query page appears again with the Query string field populated.

-
-
Select Next.
The Select the Report Type page appears.

-
Select Tabular and select Next.
The Design the Table page appears.

-
Move the fields you specified in the Query Designer window to the Displayed fields list.

-
Select Next.
The Choose the Table Style page appears.

-
Select the table style you want, and select Next.
The Choose the Deployment Location page appears.

-
In the Report server field, specify the location of the Reporting Services server.
-
Select Next.
The Completing the Wizard page appears.

-
Enter in a name for your report in the Report name field and select Finish.
The wizard closes.
-
Navigate to the Report Data pane > Datasets.
-
Right-click the dataset and select Dataset Properties.
The Dataset Properties dialog box appears.

-
In the Dataset Properties dialog box:
-
Select the Parameters tab.
-
Add any additional parameter names and values.
-
Select OK.
-
-
Select Preview to view your report.

Trending Functions
Microsoft SQL Query
Time Format
Output Time includes Field Time?
Dynamic Trend resolution available?
SELECT time, milliseconds, value, status
FROM
dbo.RTtrendWithResults(‘collect’, @pointname, ‘value’, @startDate, @endDate) AS go
Unix Epoch Time
No
No
*
SELECT time, milliseconds, value, status, fieldTime, fieldMilliseconds
FROM
dbo.RTtrendWithFieldTime(‘collect’, @pointname, ‘value’, @startDate, @endDate) AS go
Unix Epoch Time
Yes
No
*
SELECT time, milliseconds, value, status
FROM
dbo.RTtrendviewWithResults(‘collect’, @pointname, ‘value’, @startDate, @endDate) AS go
String
No
No
SELECT time, milliseconds, value, status, fieldTime, fieldMilliseconds
FROM
dbo.RTtrendviewWithFieldTime(‘collect’, @pointname, ‘value’, @startDate, @endDate) AS go
String
Yes
No
SELECT time, milliseconds, value, status
FROM
dbo.RTtrendWithDTR(‘collect’, @pointname, ‘value’, @startDate, @endDate, @dTResolution) AS go
Unix Epoch Time
No
Yes
SELECT time, milliseconds, value, status, fieldTime, fieldMilliseconds
FROM
dbo.RTtrendWithDTRFieldTime(‘collect’, @pointname, ‘value’, @startDate, @endDate, @dTResolution) AS go
Unix Epoch Time
Yes
Yes
* If RealTime Add-On 7.7.1.79 or later has been installed on your system, these two procedures will fail. If this is the case, proceed as follows:
-
Use RTtrendWithDTR instead of RTtrendWithResults with a @dTResolution of 0.
-
Use RTtrendWithDTRFieldTime instead of RTtrendWithFieldTime with a @dTResolution of 0.