To implement this feature it is necessary to inherit from the ability to List Totals, which is done via the triple:
MyEntity is a Ability.ListTotals.
This will inherit a view 'TotalAttributes' which will be added any field(s) that need to be totaled.
For this example we will use the entity OrderDetail.
The inheritance would be defined like this:
OrderProcessing.OrderDetail is a ENT Ability.ListTotals.
After inheriting from ListTotals observer that the entity OrderDetail has a new view named Total Attributes.
In the Total Attribute view choose a field(s) found on the grid to calculate its total. In this example we will use two fields from the grid: Quantity and Derived Line Total.
For the test Model there is an OrderProcessingbuildObjects list object that contains all the template generation functions for all the entities of the application:
After generating the OrderProcessingbuildObjects list generate the ApplicationServerObject which is a list of all the server objects required for the HSYNC application:
Now go to eclipse.
To import all the generated functions right click and refresh the java project:
Then run the Application Generator:
When the application is running do the following:
- Click on Application Settings then on Apply:
- Click on Application Template, select Gen Folder, and Generate Application. Wait for the message that all was generated successfully:
Now right click and refresh the web project.
Run tomcat server:
Observe that the calculated fields are correctly displayed with the right amounts