In this example, we show how to create a report using the nested grid. Two queries will be used to build this application, one based on the Customers table (Grid Master) and another based on the Orders table (Grid Detail). (To access these tables, simply create the sample project “Samples” and use its database)
Creating the grid detail
1. Create a new application based on the Orders table.
2. Change the properties: Orientation, Width table and Unit of table width for Slide, 100 and Percentage respectively.
3. In the application menu, click on the SQL element.
4. Add the following line to the SQL Query. The content written in parentheses is a global variable that will be used to pass the parameter configuration in the connection between the two queries.
WHERE
customerid = ‘[v_customer]’
5. On the ScriptCase toolbar, click the Generate Source Code button.
Creating the master grid
6. Create a new application based on the Customers table.
7. Access the toolbar of the application menu item.
8. On the top toolbar, activate the buttons: First, Back, Next, Last, Row Counter, PDF and Print aligned with the Center.
9. Also in the application menu of the toolbar, go to the Options edit tab.
10. Allow the property enabled Show summary
Creating a nested grid
11. In the application menu, access the Nested Grid folder. Within the Nested Grid folder, open the Links folder and click on the New Link item.
12. In the properties report Name and label “subgrid” and “Orders” respectively. To create the connection, click on the Create button.
13. Select the detail grid and click on the Next button.
14. In this step, we will report what the value passed to the global variable [v_customer] will be. Click on the value field and choose the customer ID field. Click on the Save button to finish.
Grid display format using blocks Grid display
Format using blocks
15. On the application menu, go to the Design folder and click on the Blocks item.
16. Click on the Create New Block button to create a new block.
17. For the Name and Label properties, report “Business“. Click on the Create button to finish.
18. Repeat the same process to create the Orders block.
19. Change the existing blocks using the format shown in the image below.
Organizing the fields of the Grid between the Blocks.
20. In the application menu, click on the Positioning fields item.
21. Organize the fields according to the image below:
22. Click on the “Run application” button
Comment this post