Back

Topic

[KB639]How to configure Batch for Dream Report?

Tags: Dream Report

12 years ago
By LM
Options
Print
Applies to:

Dream Report


Summary:

Batch Definition enables users to define a rule to dynamically calculate time periods for report generation.

This article provides a method to create Batch definition regarding PcVue variables, using SCADA Basic script to write start and end datetime in variable’s attributes and creating a view in SQL Server to make this information available for Dream Report.


Details:

  1. In the PcVue project.
    1. Create a register variable PROCESS.BATCH_ID and a copy of this variable PROCESS.BATCH_ID_DR.
    2. Authorize the extended attributes for the second variable and configure it as an HDS trend to be archived in a BATCH table archiving extended attributes (ie 3 and 4).
  2. Let us imagine a User manually entering the number of the new batch.
    1. The User will write the value in the variable PROCESS.BATCH_ID and then the batch will begin.
    2. When the batch starts, the current datetime must be written in the 3rd extended attribute of the variable PROCESS.BATCH_ID_DR:
      VARIABLE(“SETTATT”,”PROCESS.BATCH_ID_DR”,3,DATETIMESTRING(DATETIMEVALUE(),”###Y/#M/#D #h:#m:#s”)); 
    3. When the batch ends the current datetime must be written in the 4th extended attribute of the variable PROCESS.BATCH_ID_DR and write in it the value of the variable PROCESS.BATCH_ID:
      VARIABLE(“SETTATT”,”PROCESS.BATCH_ID_DR”,4,DATETIMESTRING(DATETIMEVALUE(),”###Y/#M/#D #h:#m:#s”));
      PROCESS.BATCH_ID_DR=PROCESS.BATCH_ID; 
  3. PcVue will archive the new value with Start date and End date of the batch in the BATCH table.
    1. But the format of the extended attributes is not corresponding to the format requested by Dream Report. To fit with Dream Report we can create a view of this table as described below:
      SELECT     Value AS BATCH_ID, CONVERT(DATETIME, TextAttr03, 121) AS Start, CONVERT(DATETIME, TextAttr04, 121) AS [End]
      FROM         dbo.BATCH
      WHERE     (TextAttr03 IS NOT NULL) AND (TextAttr04 IS NOT NULL) 
    2. Execute this query to test it and if the result is OK, save the view and name it BATCH_ID (for instance)
  4. Now you just have to configure an ODBC source (BATCH_ODBC) connected to the PcVue database and use this ODBC source to configure the Batch Definition in your Dream Report project:
    BatchDefinition 

 


Created on: 17 May 2013 Last update: 13 May 2024