In this tutorial we will see how to make a simple Master / Detail application. Three applications are used: a Grid (to list the employees), a Form (to edit the employee) and a Form of the type Grid Editable (to edit the details of the employee).
Creation of the form of the type Grid Editable (view).
1. Create a new Editable Grid View application using the Employeeprojects table.
2. Click on Field Positioning and remove the employeeid field
3. Open the Fields option in the menu and click on ProjectID, we change the data to Select type.
- In the Lookup Edition tab we place the SQL statement.
SELECT ProjectID, ProjectName FROM project ORDER BY ProjectID
4. For the pvalue field in the Values Format we will allow negative and positive values.
5. Click generate source code in the ScriptCase toolbar.
Creating the employee form (Master).
6. Create a new form application using the employee table.
7. Under Settings, change Table Width to 350 and Table Width Unit to Pixel.
8. Open the Fields Positioning option in the menu, remove all the fields on the right side except the Firstname.
9. Click Edit Fields, and we add the automatic increment value to the EmployeeID field.
Creating the Master / Detail relationship (linking the created applications)
10. Open the Master / Detail Form folder from the menu and click New Detail.
11. Select the detail form (the form created in the previous steps) and click Next.
12. Link the EmployeeID field from one form to another. To finish, click Next and as we have no other parameters, we select Confirm.
13. Open the Layout folder from the menu and click Blocks. Change the block attributes according to the image below:
14. Click generate source code in the ScriptCase toolbar.
Creating an employee grid.
15. Create a new grid application using the employees in the table.
16. Change the table width to 600 and the table width unit to pixel.
17. Click Field Positioning, remove all fields except EmployeeID and FirstName.
Linking the Grid with the Form (teacher)
18. Open the Application Links folder between Applications from the menu and click Create New Link.
19. Select EDIT LINK and next. We will select the master form created earlier.
20. Link the EmployeeID fields of the form to EmployeeID from the grid.
21. Change the link attributes according to the image below:
22. Save the changes and Run the application.
To see more examples created with Scriptcase, go to: Examples: Complete systems and applications with Scriptcase