Nested queries using treeview

In this example demonstrates how to create a report using Nested Grid treeview. 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: Width Table and Table Width Unit for 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.

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.


Creating a Nested Grid

9. In the application menu, access the folder Nested Grid. Inside the Nested Grid folder open the Links folder and click the New Link item.


10. In the Name and Label property report "subgrid" and "Orders" respectively. To create the connection, click the Create button.

11. Select the detail grid and click the Next button.

12. 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.

Configuring the Nested Grid as Treeview

13. Still in Nested Grid folder of the application menu click the Settings item.

14. Change the properties Enable Treeview and Position for Yes and Records Bellow respectively.