Simple Master-Detail for Employees/Projects
In this 'how to' tutorial you will create a simple master/detail application. Three applications are used: a grid (to list the employees), a form (to edit the employee) and a editable grid form (to edit the employee's detail).
Creating the editable grid form (detail)
1. Create a new Editable grid view application using the table employeeprojects.
2. Click in Fields Postioning.
3. Remove the field EmployeeID.
4. Open the folder Fields on the menu and click in ProjectID.
5. Change the Data Type to Select.
6. Open the tab Edition Lookup.
7. Add the follow SQL Statement:
SELECT ProjectID, ProjectName
8. Change Allow negative value to Yes.
9. Click in Generate Source on ScriptCase's toolbar.
Creating the form employee (master).
10. Create a new form application using the table employees.
11. In Settings, changeTable Width to 350 and Table Width Unit to Pixel.
12. Open the folder Select Fields on the menu, remove all fields from the right side except FirstName
13. Add a value to the field EmployeeID. Click on Edit Fields.
14. In EmployeeID select the option Auto increment (Automatic).
15. Open the folder Layout on the menu and click in Blocks.
16. Change the Block attributes according to the image below:
Creating the Master/Detail relation (linking the applications created)
17. Open the folder Master/Detail Form on the menu and click in New Detail
18. Change Name and Label on the right side. Click in Create button.
19. Select the detail form (the form the created in the steps above) and click Next.
20.Link the field EmployeeID from one form to another. To end click in Save.
21. Click in Generate Source on ScriptCase's toolbar.
Creating an employee grid.
22. Create a new grid application using the table employees.
23. Change Table Width to 600 and Table Width Unit to Pixel.
24. Click in Select Fields, remove all fields except EmployeeID and FirstName.
Linking the grid with the form (master)
25. Open the folder Link on the menu and click in New Link.
26. Click in Create New Link to start the wizard.
27. Select Application in link type and click Next.
28. Select the master form created before and click in Next.
29. Link the fields EmployeeID from the form to EmployeeID from the grid.
30.Change the link attributes according to the table below: