Write the Class Script
In this procedure, you will write a class script that uses the ProjectObject class you created in
Create a User Class.
To write the class script
1. In the open Class Editor for the ProjectObject user class, click Tools, Script.
The Script Editor opens.
2. Enter the following code:
METHOD SaveProject()=
{
update project
set project_name = :CurObject.project_name,
assigned_to = :CurObject.assigned_to,
level_of_effort = :CurObject.level_of_effort,
due_date = :CurObject.due_date,
start_date = :CurObject.start_date,
date_completed = :CurObject.date_completed
where project_id = :CurObject.project_id;
commit;
}
METHOD LoadProject()=
{
SELECT project_name AS :CurObject.project_name,
assigned_to AS :CurObject.assigned_to,
level_of_effort AS :CurObject.level_of_effort,
due_date AS :CurObject.due_date,
start_date AS :CurObject.start_date,
date_completed AS :CurObject.date_completed
FROM project
WHERE project_id = :CurObject.project_id;
commit;
}
3. Save the script and close the Script Editor.
4. In the Class Editor, click Tools, Compile to compile the script.
5. Click File, Save in the Class Editor, and then close the Class Editor.
The ProjectObject user class is listed in the Components portlet of the Develop tab.
Leave the frame open. You can now add a composite field to a frame that uses the user class.