OLE DB Provider Samples
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:
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.
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.
Changing the Server Name
- Open the report file in Crystal Reports.
- Click the Database menu.
- If the Database menu does not appear automatically, follow these steps
- If the Database menu appears automatically, follow these steps:
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.
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
Using the Sample .ODC File
Importing Data Using the Sample .UDL File
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.
Opening the iFIX Sample Picture
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.
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. |