OLE DB Provider Samples

Important: You do not have the latest version of Historian! You are missing out on the newest capabilities and enhanced security. For information on all the latest features, see the Historian product page. For more information on upgrades, contact your GE Digital sales agent or e-mail GE Digital Sales Support. For the most up-to-date documentation, go here.

About the Samples

Historian OLE DB Provider includes samples from various applications that demonstrate some possible applications of the provider. Use these reports directly or modify them to fit your requirements. They are provided as examples, and are not the only way of creating reports in the specified clients. The sample reports are located in the subfolders of the Historian\Samples folder.

The following list outlines the applications for which samples are included:

Note: You must specify a server name or enter a login username and password when you connect to the Historian server from these applications. For instance, in ADO you pass the server name, username, and password in the connect string.

Crystal Reports Samples

You can find the Crystal Reports v8.0 Professional samples in the Historian\Samples\Crystal folder. The following table outlines the sample reports included in this folder.

Table 1. Crystal Reports Samples
File Name Description
SimpleCrystal80Report.rpt Report showing values cast from Variant to Float.
MultipleServersSubreport.rpt Report that retrieves data from two servers by using a subreport.
iFIX1_CHART_OLEDB.rpt Report from the iFIX Sample System converted from the iFIX Historical ODBC driver to OLE DB.
iFIX1_CROSSTAB_OLEDB.rpt Report from the iFIX Sample System converted from the iFIX Historical ODBC driver to OLE DB.
iFIX1_DAILY_OLEDB.rpt Report from the iFIX Sample System converted from the iFIX Historical ODBC driver to OLE DB.

Use the Crystal Reports Samples

Open any of the sample Crystal Reports in Crystal Reports v8.0 Professional. The following figure shows the SimpleCrystal80Report.rpt file, which reports the value, quality, and timestamp of Historian tags.

Figure: Sample Crystal Report

Changing the Server Name

Make sure that you change the Historian Server name to point directly to your Historian server, so that the report generates correctly in Crystal Reports. By default, this server name is T20.
  1. Open the report file in Crystal Reports.
  2. Click the Database menu.
  3. If the Database menu does not appear automatically, follow these steps
    1. Wait for approximately 90 seconds for the connection timeout to occur.
      After the 90-second timeout, the Data Link Properties dialog box appears. Although it may appear as if Crystal Reports has stopped working or is frozen before the timeout occurs, this functionality is as expected.
    2. Change the Data Source field.
      You can leave this field empty to use the default Historian server or enter a specific Historian server name.
    3. Click OK.
    4. Skip step 4.
  4. If the Database menu appears automatically, follow these steps:
    1. Select Set Location from the Database menu.
      The Set Location dialog box appears.
    2. Click Set Location.
      The Data Explorer appears.
    3. Select a source and click Set.
    4. Click Done.

Microsoft Excel Samples

You can find the Microsoft Excel samples in the Historian\Samples\Excel folder. The following table outlines the samples included in this folder.

Table 2. Microsoft Excel Samples
File Name Description
ihOLEDB_ LASTHOUR.XLS One-sheet report that uses auto-refresh to display the last hour of data using relative shortcuts.
ihTags.odc Data source file that retrieves the ihTags table from the default server.
iHistorian.udl Sample universal data link (.UDL) file that connects to the default Historian server with the currently logged-in user.

Opening the Sample Excel Report

  1. Open Microsoft Excel.
  2. Select Open from the File menu.
    The Open dialog box appears.
  3. Select the ihOLEDB_LASTHOUR.XLS file in the Historian\Samples\Excel folder and click Open.
    The sample report opens, as shown in the following figure.

    Figure: Sample Excel Report

Using the Sample .ODC File

  1. Open Microsoft Excel.
  2. Select Open from the File menu.
    The Open dialog box appears.
  3. Select the ihTags.odc file in the Historian\Samples\Excel folder and click Open.
    The sample report opens, as shown in the following figure.

    Figure: Sample Excel Report Using the .ODC File

  4. To update the data in this display, click the Refresh button on the External Data toolbar.
    • To view the External Data toolbar if it is not available, select Toolbars from the View menu, and then click External Data.

Importing Data Using the Sample .UDL File

With the sample universal data link (.UDL) file, you can specify the connection information so that Excel can connect to the tables in Historian OLE DB Provider and import data using the default server and the currently logged-in user.
  1. Open Microsoft Excel.
  2. From the Data menu, select Import External Data, and then select Import Data.
    The Select Data Source dialog box appears.
  3. Select the Historian.udl file in the Historian\Samples\Excel folder, and then click Open.
    The Select Table dialog box appears.
  4. Click the table that you want to query, and then click OK.
    The Import Data dialog box appears.
    Note: If you want to run a SQL command instead of the default table command setting, refer to Edit SQL Queries in Excel.
  5. Click OK to import the column data from the selected table.
    Historian data populates the current spreadsheet.

iFIX and VisiconX Sample

You can find the iFIX sample picture with the VisiconX controls in the Historian\Samples\iFIX folder. The name of the sample in this folder is HistoricalAnimation.grf.

Note: To use iFIX with VisiconX, you may have to edit your FixUserPreferences.ini configuration file. Refer to Updating FixUserPreferences.ini for more information.

Opening the iFIX Sample Picture

  1. Copy HistoricalAnimation.grf to your Dynamics/Pic folder.
  2. Start iFIX.
  3. Open the iFIX WorkSpace, if not already open.
  4. Double-click the Pictures folder in the iFIX WorkSpace tree.
  5. Double-click the HistoricalAnimation picture to open the picture in the WorkSpace.
    The picture appears, as shown in the following figure.

    Figure: iFIX Screen With VisiconX Controls

  6. Experiment with the sample:
    • Try switching between the configure and run modes.
    • Follow the steps on the picture.
    • Try editing the picture.
    • View the properties of the VisiconX controls.
    • Change the properties.
    Note: You can have multiple VisiconX controls that each link to different Historian servers.

Create a Background Schedule to Run Crystal Reports

In iFIX, you can create a background schedule that runs Crystal reports. Sample Visual Basic code to perform this function is detailed below:

Private ReportFileName
Private CrystalReport

Private Sub KKTimer_OnTimeOut(ByVal lTimerId As Long)

Set CrystalApplication = CreateObject("Crystal.CRPE.Application")
Set CrystalReport = CrystalApplication.OpenReport("C:\Dynamics\APP\RTtemplate.rpt") CrystalReport.Printout False

Set CrystalReport = Nothing
Set CrystalApplication = Nothing
End Sub

Visual Basic and ADO Samples

You can find the Visual Basic and ADO samples in the Historian\Samples\VB folder. The following table outlines the samples included in this folder.

Table 3. Visual Basic and ADO Samples
File Name Description
SimpleADOExample.vbp Visual Basic project file that uses a simple ADO example with a connect string.
modSimpleADOExample.bas File that is part of the SimpleADOExample.vbp project file.
iholedb_databoundgrid.vbp Visual Basic project file that displays a data-bound grid example that fetches data from the ihRawData table.
frmMain.frm File that is part of the iholedb_databoundgrid.vbp project file.
frmMain.frx File that is part of the iholedb_databoundgrid.vbp project file.