Reports

<< Click to Display Table of Contents >>

 

Reports

How can I add the current date and time on an E3 Report?

There are at least two alternatives to solve this:

Add a Label on Page Header Section and on Page Header Section's OnFormat event, type the following script (Label1 is Text's name):

Report.Sections("PageHeader").Controls("Label1")._
  Caption = Now

 

Create a CurrentTime-type Demo Tag. On Report's header or footer, users must insert a SetPoint object and, in the DataField property, type Tag's full name (for example, "Data.DemoTag1.Value"). Configure the desired date format. This can be performed by right-clicking an object and setting its properties, or else directly typing a format in the OutputFormat property, in the Properties List (an example of date format is "MM/dd/yyyy hh:mm:ss").

 

I have a Report that displays a Query result with a filter by date. When this Report is generated, its Query does not return all values configured via script for these variables. How can I solve this problem?

Check, in the script that configures or accesses this Report, if after configuring these values for Query variables a LoadReport method was not triggered, since this method loads a Report with all settings performed in E3 Studio. Use only once the LoadReport method in a script, loading a Report to a variable (using the Set command).

 

How can I correctly execute a Report that uses the CopyConfig method to copy all configurations of an E3Chart on a Screen to it?

The CopyConfig method does not copy values of query variables, this must be performed using scripts inside a chart. Pens configured in an E3Chart on Screen are of type Real.

 

How can I create a filter by date on a Report?

Create a SQL query in a Report filtering by start and final date. On a Screen that generates this Report, users must execute the configured SQL query, passing the start and final date values. The script of a button on the Screen where this Report is generated, for example, can be implemented this way:

StartDate = CDate(Screen.Item("StartDateText").Value)
EndDate = CDate(Screen.Item("EndDateText").Value)
Set Report1 = Application.LoadReport("Report1")
Set Query = Report1.Item("Query1")
Query.SetVariableValue "StartDate", (StartDate)
Query.SetVariableValue "EndDate", (EndDate)
Report1.PrintPreview()

 

How to display dates used as a filter on a Query of a Report's Page Header?

First, add two SetPoints on Page Header (one to display the start date and another one to display the end date) and create a script that passes those values loaded on Screen SetPoints (and transferred to that Query) to these two SetPoints. The script to be created on Page Header object, on Report's OnBeforePrint event, can be as follows:

Set data = Application.GetFrame().Screen
Report.Sections("PageHeader").Controls("Field5").Text = _
  data.Item("StartDateText").Value
Report.Sections("PageHeader").Controls("Field6").Text = _
  data.Item("EndDateText").Value

 

Then, link two Internal Tags to Screen's SetPoints where dates are specified. Link these Tags to Report's SetPoints.

 

How do I print two Reports on distinct printers?

Create the following script on Report's OnReportStart event:

Sub OnReportStart
  Report.Printer.DeviceName = "Printer Name"
End Sub

 

How do I use an OnError script event to display an error message when printing a Report fails?

Report's OnError event does not allow executing scripts inside it, having only internal purposes. This means that it is not possible to change this error message, nor execute any other procedure on this event.

Was this page useful?