> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-vi-scada/datran-reporting/database-views.md).

# Database tables and views for reports

The DATRAN database tables and views you can report on, including the extra views DATRAN Reporting adds for hourly, daily and monthly figures.

The DATRAN database is the generic SQL database that DATRAN VI uses to log historical data from the DATRAN VI Tree Base Database. From this information it should be possible to write reports using the data stored in the database. DATRAN Reporting automatically creates and updates the tables and views that it needs.

{% hint style="info" %}
**Applies to:** DATRAN Reporting V6.x. See [Database logging and SQL Server](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/sql-server.md).
{% endhint %}

## Tables

| Table                     | Holds                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tblPoint                  | Associates a unique ID to every point that is logged to the database from Datran. Station Name (strStation) stores the name of the station at which the point exists. The point name is made of the equipment name and the point name joined with a space in between (i.e. ‘Pump No1 Run’ where ‘Pump No1’ is the equipment name, and ‘Run’ is the point name).              |
| tblPoints                 | Stores additional information about any points that are logged to the database: Site Name, Equipment Type, Equipment Name, Point Name, Point Units, System Name, Station Address, Point Type (i.e. analogue, alarm or event), Point Maximum Value and Point Minimum Value (used by historical trending to determine the maximum and minimum value to be used on the Y-axis). |
| tblAnalog                 | Stores information relating to analogue points in DATRAN: Point ID, Log Time and Value.                                                                                                                                                                                                                                                                                      |
| tblAnalogHH               | Stores the statistical summary of data within the Analogues table generated by the sp\_AnalogDataStats stored procedure: the type of statistical summary (minimum, average and maximum).                                                                                                                                                                                     |
| tblDigital                | Stores the sequence of events relating to a particular digital event, or alarm. This sequence involves the digital turning on, turning off, and being acknowledged (for alarms): On Time, Off Time, Acknowledgement Time and Acknowledgement Operator.                                                                                                                       |
| tblEvent                  | Stores information about a digital event: Event Occurrence Time, Event Type (usually ALM, RTN, or ACK), Point ID, Cause Of Event and Operator ID.                                                                                                                                                                                                                            |
| tblOperator               | Associates a unique ID to every operator that it used within the database: Operator ID and Operator Name.                                                                                                                                                                                                                                                                    |
| tblPaging                 | Stores information about any paging messages that have been sent out from Datran due to any alarms.                                                                                                                                                                                                                                                                          |
| tblSMSMessaging           | Stores information about any text messages that have been sent out from DATRAN VI due to any alarm, acknowledgement or return to normal event: Event Occurrence Time, Event Type, Point ID, SMS Message Time, SMS Message State, Operator ID, Response, Alias ID, Alarm Id and Alarm Class.                                                                                  |
| tblNotes, tblNotesHistory | tblNotes associates a unique ID to every note that it used within the database. tblNotesHistory shows information relating to changes made to notes in DATRAN: whether the note was added (0), edited (1) or deleted (2) by the operator.                                                                                                                                    |
| tblSecurity               | Stores information about any operator logins and logouts that have ever occurred. A NULL value for the logout time means either the operator has not left the site/station or he has left the site/station without logging out.                                                                                                                                              |
| tblPlots, tblPens         | tblPlots stores information about the plots that have been set up in historical trending. tblPens stores the details of all historical trending plot pens.                                                                                                                                                                                                                   |

Alarm Id (iAlarmId). This table may contain multiple entries regarding the same Alarm. For instance when an SMS was sent regarding an alarm, someone acknowledged the alarm, the alarm returned to normal etc. All of these entries will have the same Alarm Id which means that they can be grouped together for when creating any reports. Note this is a v6.68SP2 feature. Alarm Class (strAlarmClass). This shows the Alarm Class as specified in DATRAN that was used to generate the Alarm. This can be useful for creating reports whereby you only wish to list, say, critical or priority alarms. Note this is a v6.68SP2 feature.

## Standard views

| View           | Shows                                                                                                                                                                           |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| vwAnalog       | Shows information relating to analogue points in Datran: Station Name, Point Name, Log Time and Value.                                                                          |
| vwDigital      | Shows the sequence of events relating to a particular digital event, or alarm. This sequence involves the digital turning on, turning off, and being acknowledged (for alarms). |
| vwNotesHistory | Shows information relating to changes made to notes in DATRAN. Action signifies whether the note was added (0), edited (1) or deleted (2) by the operator.                      |
| vwPage         | Shows information about any paging messages that have been sent out from Datran due to any alarms. The Pagings View is added for older versions of DATRAN database.             |
| vwSecurity     | Shows information about any operator logins and logouts that have ever occurred on site.                                                                                        |
| vwSMSMessage   | Shows information about any text messages that have been sent out from DATRAN VI due to any alarm, acknowledgement or return to normal events.                                  |

## Views DATRAN Reporting adds

This DATRAN Reporting application adds these additional views:

| View                      | Period                                                                                                                                                                                                                                                                           |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| vwAnalogHourly            | Shows information relating to analogue points in Datran on an hourly basis: Station Name, Point Name, Day, Hour, Minimum Value, Maximum Value and Average Value.                                                                                                                 |
| vwAnalogDaily             | Shows information relating to analogue points in Datran on a daily basis: System Name, Site Name, Equipment Type, Equipment Name, Point Name, Date, Year, Month Name, Month, Day, Minimum Value, Maximum Value, Average Value, Sum Value and Point Units.                        |
| vwAnalogDailyMinus12Hours | The only difference between this view and Analogues Daily view is that in this view all timestamp values have been reduced by 12 hours. This is to accommodate scenarios such as this: where the daily accumulated flow of yesterday is calculated at 8 a.m. today.              |
| vwAnalogDailyMinus24Hours | The only difference between this view and Analogues Daily view is that in this view all timestamp values have been reduced by 24 hours. This is to accommodate scenarios such as this: where the total flow of yesterday is calculated at the end of the day i.e. midnight.      |
| vwAnalogDailyMinus32Hours | The only difference between this view and Analogues Daily view is that in this view all timestamp values have been reduced by 32 hours. This is to accommodate scenarios such as this: where the previous day's accumulated flow is calculated at 8 a.m. today.                  |
| vwAnalogDailyScheduled    | Shows information relating to analogue points in Datran on a daily basis. Scheduled views must be used for scheduled reports.                                                                                                                                                    |
| vwAnalogMonthly           | Shows information relating to analogue points in Datran, with the minimum, maximum, average and sum value of the analogue within the particular month.                                                                                                                           |
| vwAnalogMonthlyMinMaxDate | Slightly different from the Analogues Monthly view in that it has two additional columns i.e. Minimum Date and Maximum Date. These columns tell the user when the minimum and/or maximum value occurred within a particular month. The accuracy is down to the very last second. |

Scheduled: This means that a view's date time is tied to the parameters table (rb\_parameter) start and stop datetime fields. Scheduled views must be used for scheduled reports. If not, the reports that are printed will always include data within the same period.

See [A point's data is split or has gaps](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/troubleshooting/split-or-missing-data.md).
