Updating Fields with the Run Button in a Grid Application
This option in the Grid allows to create a button to process a PHP code in selected records (checkbox).
Creating a new button
1. Performing actions on multiple rows of a Grid application can be done creating a new button in the Grid.
2.We will name the field "Process" and select the type "Run".
3. This kind of button has 2 events to process PHP Codes.
4. In the code of our button we need some global variables, then, first, let's create these variables accessing the onScriptInit event in the application menu ...
... and use the code below
5. Now we can use [i] and [total_chked] in the onRecord and onFinish of the Run button.
Event Button: Onrecord
Event Button: OnFinish
6. Access the menu "Layout >> Header and Footer" and enable the footer view, because we will use the application onFooter event.
7. Now let's use the event onRecord of the application to change the color of the field
8.And onFooter event of the application to clear the array.
9. Now we must access the "Application >> Global Variables" menu to set [tot], [arr_vl] and [i] as variable "OUT".
10. Run the application, select the records and click on the button "Discount".