Weekly Electrical Demand Report

Bound tables and charts can be used in a report Px page to display historical information. An example might be to create a report which displays electrical demand readings for the previous week.
  • Creating the History Query

    Any history in the station can be queried using bql. The bql query builder can be used to create the query or you can simply type the syntax below.

    history:/demo/BldgKw|bql:select *
    Figure 50.   Creating query for the BldgKw history
    Image
  • Limiting the Query

    The above bql query will return a table which contains all of the records available in the referenced history. If the export source object is executed once a week, then it would probably be safe to limit the query to the previous weeks worth of data. The period syntax can be used to limit the query as below.

    history:/demo/BldgKw?period=lastWeek|bql:select *

    This will still return a significant amount of data. Assuming that the data is recorded in fifteen minute intervals, this would return 672 records and the pdf file would span seventeen pages. Bql includes a special function called history rollup. This function can be applied to the previous query to display the same results using fewer records. Each record in the rollup indicates the number of samples, minimum value, maximum value, average value and a sum of all samples. The below example uses the history rollup function with a daily interval which results in only seven records (one for each day of the week) displayed in the table.

    history:/demo/BldgKw?period=lastWeek|
    bql:history:HistoryRollup.rollup(baja:RelTime '86400000')
     NOTE: The history rollup function does not allow specifying which columns are to be displayed. By default all columns are displayed in the table. 
  • Using a Chart

    In some cases it may be a requirement to display the data in chart form as opposed to using a table. The chart palette includes two types of chart widgets, the line and bar chart. After adding the line chart widget to the Px file, table chart bindings may be added and configured. The previous query can be used in the ord field of the table chart binding. Each table chart binding represents one trace on the chart and must specify which column of the query to display on the Y axis. Multiple table chart bindings can reference the same query but display different columns such as min, max, avg or sum.

    Figure 51.   Creating table chart queries for the BldgKw history
    Image
     NOTE: The current export mechanism does support using history chart tables or history chart views directly in the report Px file. Both the history table and chart views allow exporting directly from the specific view.