<< Click to Display Table of Contents >>
Section Reports |
There are at least two alternatives to solve this:
•Add a Text object on the Page Header Section and on the 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 Section Report's header or footer, users must insert a SetPoint object and, in the DataField property, type Tag's full name, such as "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 Section Report, if after configuring these values for Query variables a LoadReport method was not triggered, since this method loads a Section Report with all settings performed in Elipse E3 Studio. Use only once the LoadReport method in a script, loading a Section Report to a variable, by 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 Section Report filtering by start and final date. On a Screen that generates this Section 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 Section 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 the Page Header object, on Section 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 Section Report's SetPoints.
Create the following script on Section Report's OnReportStart event.
Sub OnReportStart
Report.Printer.DeviceName = "Printer Name"
End Sub
Section Report's OnError event does not allow executing scripts inside it, having only internal purposes. This means that users cannot change this error message, nor execute any other procedure on this event.