Working with Reports
About Working with 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.
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. Each client using the worksheets must have the Historian Excel Add-In installed and enabled inside Excel.
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.
This manual contains hypertext links that open the provided Historian Sample Reports directly in Excel. If you did not install the Excel Add-In, or if you have moved the Sample Reports from the Sample directory, or moved the Historian.chm file from its installed location, you will receive an error when you click on these links and will be unable to take advantage of this functionality.
The three sample Excel reports are built using tags from the Simulation Collector. You must have the Simulation Collector installed on a machine and collecting data to the Historian Server 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 the 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 first install 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 make this 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 (Yes) or keep the existing information (No). It is recommended that you select No and 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
This report calculates, for a specified time period, a number of statistical properties of a tag, such as 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
This sample report shows how the measured values and selected statistical properties of specified tags have varied during the previous 24-hour period. This sample is an example of a typical daily performance report in an industrial plant.
Batch Sample Report
Here is an example of a report that might be used with a batch type of industrial process. The table at the top of the report shows the batch identification, the start and end times, product name, and computed statistics for several process variables. The charts show how selected process parameters varied during the batch cycle.
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 (Yes) or keep the existing information (No). It is recommended that you select No and 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 Example
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 nmust modify the path of the .XLA and .XLS files. The paths that you need to edit are bolded in the following example.
To use this example, a user must have the privileges to run the collector as a Windows service in Windows and a default printer must be installed. If Historian security is enabled, the user must have iH Readers membership. 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 calculation mode. See the Calculation Modes section in the Getting Started with Historian guide for a complete list. |
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 or 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:
Filter Expression can be used instead of |
pFilterMode |
The type of time filter:
The For example, |
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 sampling mode used by the query. See the Sampling Modes section in the Getting Started with Historian guide for a complete list. |
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 that you are retrieving data from, you do not have to 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. |