Reports
- Defining Reports
- You can define a report so that Excel recalculates the worksheet whenever the contents of specific cells, such as start times or dates, change. In this way, the report generates a dynamic snapshot of process performance, updated regularly in real time. You can also manually initiate recalculation at anytime.
- Building Dynamic Reports
- The primary rule to follow in building a dynamic report is to use formulas with cell references that contain variable information rather than fixed data, so that recalculation produces new data each time it occurs. You then initiate recalculation by changing certain inputs manually or automatically.
- Sharing Reports
- You can share any Excel reports you develop with the Historian Excel Add-In as you would any other Excel workbook. For each client using the worksheets, set up the Excel Add-In for Historian.
Using the Sample Reports
The Historian application includes three typical sample reports that demonstrate the power and ease-of-use of the Excel Add-In. Use them directly in your application or modify them to fit your requirements.
The three sample Excel reports are built using tags from the Simulation collector. You must create an instance of the Simulation collector and start it in order for these reports to work. The Historian Batch Report Sample.xls file also uses Batch ID and Product ID tags from the Simulation collector. These are Simulation Collector points that are configured to store string data types.
To ensure that the sample reports work correctly, you must add the string tags. These are the last five tags in the tag collector list. Add the string tags in Historian Administrator by browsing the Simulation collector and adding all of the tags by selecting the Add All Tags check box. Alternatively, you can run the Add Tags to Simulation Collector.bat batch file in the Historian\Server directory of the machine that has the Simulation collector.
In addition, when you create an instance of the Simulation collector, it prompts you for the number of simulation tags it should create (but you must still add the tags for collection using one of the two methods above). The default is 1000. Do not enter a value less than 30.
When opening a sample Excel report, you may receive a message prompting you to update all linked information in the workbook or keep the existing information. It is recommended that you select No (that is, keep the existing information). The links will be automatically updated for your worksheet. Save your worksheet after the links have been updated.
Historian Statistical Analysis Sample Report
For a specific duration, this report calculates a number of statistical properties of a tag, such as the average, maximum, minimum, standard deviation, 2 sigma and 3 sigma control limits, and correlation coefficients for other tags. It displays charts of various types for several of these variables.
Daily Performance Sample Report
Batch Sample Report
Troubleshooting the Excel Add-In Sample Reports
If you follow the recommended installation procedures, you should not have any difficulty in running the sample reports. If you do encounter any problems, they are likely to relate to the locations of files and the links to those files.
When opening a sample Excel report, you may receive a message prompting you to update all linked information in the workbook or keep the existing information. We recommend that you select No (that is, keep the existing information). The links will be automatically updated for your worksheet. Save your worksheet after the links have been updated.
For problems in the worksheets themselves, refer to Excel online Help for assistance.
Running a Report Using Visual Basic
The following Visual Basic example shows you how to create a hidden instance of Microsoft Excel, open a preconfigured Historian report in that instance, and then print the report to the default printer. To use the example, you must modify the path of the .XLA and .XLS files. The paths that you need to edit are in bold font in the following example.
To use this example, you must have the privileges to run the collector as a Windows service and a default printer must be installed. If Historian security is enabled, you must be a member of the iH Readers group. Tag-level security can override this privilege.
Sub CreateExcelObjects()
Dim xlApp As Excel.Application Dim wkbNewBook As Excel.Workbook Dim wksSheet As Excel.Worksheet Dim strBookName As String
' Create new hidden instance of Excel. Set xlApp = New Excel.Application
' Open the preconfigured Historian Excel Add-in report.
Workbooks.Open "C:\Program Files\Microsoft Office\Office11\Library\iHistorian.xla"
Set wkbNewBook = Workbooks.Open("c:\testih.xls", 0, False)
'xlApp.Visible = True
With wkbNewBook
For Each wksSheet In .Worksheets
Select Case wksSheet.Name Case "tag1" wksSheet.Select
.RefreshAll
.PrintOut End Select Next wksSheet
.Close False
End With
Set wkbNewBook = Nothing xlApp.Quit
Set xlApp = Nothing
End Sub
Array Formulas for the Historian Excel Add-In
ihSearchTags
(pServer,pTagMask,pDescriptionMask,pCollector,pArraySize,pSort,pRowCol,Parameters())
ihQueryData
(pServer-,pTagName,pStartTime,pEndTime,pSamplingMode,pCalculationMode,pSamplingInterval,pNumberOfSamples,pDirection,pFilterTag,pFilterMode,pFilterComparisonMo ())
ihQueryData3
(pServer,pTagName,pStartTime,pEndTime,pSamplingMode,pCalculationMode,pSamplingInterval,pNumberOfSamples,pDirection,pFilterTag,pFilterMode,pFilterComparisonMo ())
ihQueryMessages
(pServer,pTopic,pStartTime,pEndTime,pSearchText,pArraySize,pSort,pRowCol,Parameters())
ihListArchives
(pServer,pArchiveNameMask,pArraySize,pSort,pRowCol,Parameters())
ihListCollectors
(pServer,pCollectorNameMask,pArraySize,pSort,pRowCol,Parameters())
When inserting an array formula, you cannot overwrite part of the range of another array formula in your worksheet. The range includes cells without data displayed. An error message appears if you try to do so. Reselect a different output range to insert the formula.
Array Formula Parameters
Parameter | Description |
---|---|
pArchiveNameMask
|
A search mask you can use to browse the archivers. Use standard Windows wildcard characters. |
pArraySize
|
The number of cells that the array spans. |
pCalculationMode
|
The type of the calculation mode. |
pCollector
|
The collector or collector mask that you want to query. |
pCollectorNameMask
|
A search mask for browsing collectors. Use standard Windows wildcard characters. |
pDescriptionMask
|
A search mask for browsing tag descriptions. Use standard Windows wildcard characters. |
pDirection
|
The direction (forward/backward from the start time) of data sampling from the archive. |
pEndTime
|
The end time used to refine your query. |
pFilterComparisonMode
|
The type of comparison to be made on the
filter comparison value:
|
pFilterComparisonValue
|
The value to compare the filter tag with when applying the appropriate filter to the DataRecordset query (to determine the appropriate filter times). |
pFilterExpression
|
An expression that includes multiple filter
conditions. The type of conditions used are:
You can use a filter expression instead of
|
pFilterMode |
The type of the time filter:
|
pFilterTag |
The single tagname used when applying the filter criteria. |
pNumberOfSamples |
Number of samples from the archive to
retrieve. Samples will be evenly spaced within the time range
defined by start time and end time for most sampling modes. For
the |
pRowCol |
The sorting criteria used: 0 for columns and 1 for rows. |
pSamplingInterval |
For non-raw sampled data, this column represents a positive integer for the time interval (in milliseconds) between returned samples. |
pSamplingMode |
The type of the sampling mode used by the query. |
pSearchText |
The text or mask that you want to search for in the message. |
pServer |
Name of the server from which you are retrieving data. If you are running Excel on the same server from which you are retrieving data, you need not enter a string, as the default server is used. |
pSort |
The sorting criteria used for the rows or columns: 0 for descending and 1 for ascending. |
|
The start time used to refine your query. |
pTagMask |
A search mask for browsing tagnames. Use standard Windows wildcard characters. |
pTagName |
The tagname or tagname mask that you want to query. |
pTopic |
The message topic:
|
Parameters() |
Output display of the array formula. This field can include be one or more parameters. |