Question:
How can I execute math operations between two or more columns shown in a Section Report in Elipse E3?
Solution:
The report is generated from handling and including Text and Datafield objects to their sections. The column printed in the report shows the results from filling a Datafield’s DataField property in a Detail section. This property (DataField) reflects the search in the Database.
Therefore, to execute math operations between columns in the section report, it’s possible to access the fields (SectionReportField) of the report or the query fields via scripts.
This is the example of a script for adding and multiplying between columns in a report:
Sub ActiveReport_ReportStart 'This script is required for the proper function of E3Chart controls 'If you wish to access the data in the application, you can use the object 'Application' created below dim Application = Activator.CreateInstance(Type.GetTypeFromProgID("Reports.E3ApplicationLink")) Application.LinkWithApplication(rpt) End Sub Sub Detail_BeforePrint me.TextBox4.Value = Val(me.TextBox2.Value) + Val(me.TextBox3.Value) me.TextBox5.Value = Val(me.TextBox2.Value) * Val(me.TextBox3.Value) ' me.TextBox4.Value = Val(rpt.Fields.Item("Campo").Value) + Val(rpt.Fields.Item("Campo2").Value) ' me.TextBox5.Value = Val(rpt.Fields.Item("Campo").Value) * Val(rpt.Fields.Item("Campo2").Value) End Sub