In this exercise we will use the Summary node, which allows the developer to define a section to summarize information from the grid of selected items. In this section we will place a total amount that will be the sum to be paid for the selected products.
- Right-click on the multiple selection node and select Add / Attributes.
- Add a variable with the following properties:
- BasedOn: ProductPrice
- Description: Total
- Save the web panel to update the web form and variables.
- Once the variable has been defined, we need to program the code that will update the total value.
To do so, we have to increase the total in the Load event of the selected items grid.
To quickly access the subroutine that we need to implement, we can use the GoToEvent property of the multiple selection node.
|Go To Event
- Right-click on the multiple selection node and in Go To Event select the "U_LoadSelectedGridRowsVar".
- This subroutine is invoked in the Load event of the grid with selected products before loading each one. The product number that will be loaded is indicated by the variable &SelectedGridLoadCount_MultipleSelection. Therefore, if it is the first product we start the total variable; otherwise, we increase the value of the existing variable. To do so, place the following code in the subroutine.
If &SelectedGridLoadCount_MultipleSelection = 1
&Total = &Selected_ProductPrice
&Total += &Selected_ProductPrice
- Press F5 to execute the web panel to see the result.