In this example demonstrates how to create a report using Nested Grid. To build this application will be used two queries, one based on the Customers table (Grid Master) and another based on the Orders table (Grid Detail). (To access these tables just create the sample “Samples” project and use your database)
Creating the Detail Grid
1. Create a new application based on the Orders table.
2. Change the properties: Orientation, Width Table and Table Width Unit for Slide, 100 and Percentage respectively.
3. In the application menu click on the SQL item
4. Add the following line to the SQL Query. The contents written in brackets is a global variable that will be used for the passage of parameter settings in the connection between the two queries.
WHERE customerid = '[v_customer]'
5. In 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 application menu item Toolbar.
8. In Top Toolbar enable the buttons: First, Back, Next, Last, Rows Counter, PDF and Print aligned to the Center.
9. Also in the item Toolbar application menu, go to Options edit tab.
10. Let enabled property Display Summary
Creating a Nested Grid
11. In the application menu, access the folder Nested Grid. Inside the Nested Grid folder open the Links folder and click the New Link item.
12. In the Name and Label property report “subgrid” and “Orders” respectively. To create the connection, click the Create button.
13. Select the detail grid and click the Next button.
14. In this step we will inform what will be the value passed to the global variable [v_customer]. Click the value Field and choose the customerid field. Click the save button to finish.
Formatting Grid Visualization using Blocks
15. In the application menu, go to Layout folder and click on the item Blocks.
16. Click on the Create New Block button to create a new block.
17. For the Name and Label properties inform “Business”. Click 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 item Fields Positioning.
21. Arrange the fields according to the image below: