<< Click to Display Table of Contents >>
Reports |
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").
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).
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.
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()
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.
Create the following script on Report's OnReportStart event:
Sub OnReportStart
Report.Printer.DeviceName = "Printer Name"
End Sub
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.