Step 8. Add Update Employee Note Logic

The Multi-Line Edit Box is a list control. Its default properties include MaximumLineLength = 4096, MaximumLines = 10,000 and WordWrap = True. Our field xEmployeeNote is a String field, length 4096. Once text has been added by an ADD_ENTRY, the user can extend and change the text. This could include adding sufficient text to exceed 4096 which would need to create a second entry in the table xEmployeeNotes. We will keep this exercise simple, but our code could easily check for a second entry and provide a warning "Not saved" or create a new record in the table xEmployeeNotes.

Always remember to use F2 to open the Features tab for any component. You can then obtain further help for a control by double clicking on a property, event or method.

1.We need to extend the SaveNoteButton.Click event to perform the following:

Assign notes CreateUpdate date field to current date/time

Selectlist xEmployeeNotes

Update fields CreateDate and Note in table xEmployeeNotes with key GUID

Leave loop /* process one entry only */

End Select

* Rebuild list NotesList

Clear NotesList

Select fields NotesList from table xEmployeeNotesByEmployee with key xEmployeeIdentification

Add entry NotesList

End Select


     Your code should look like the following:

Evtroutine Handling(#SaveNoteButton.Click)

#xEmployeeNoteCreateUpdate :=

Selectlist Named(#EmployeeNotes)

Update Fields(#xEmployeeNote #xEmployeeNoteCreateUpdate) In_File(xEmployeeNotes) With_Key(#xEmployeeNoteGUID)



Clr_List Named(#NotesList)

Select Fields(#NotesList) From_File(xEmployeeNotesByEmployee) With_Key(#xEmployeeIdentification)

Add_Entry To_List(#NotesList)



     Note: Your form is designed to handle a single employee and edit a single note. Your updates are using the current form variables for xEmployeeIdentification and xEmployeeNoteGUID.

2.  Compile and test the form. Having selected a note for an employee you can now edit or extend the text in the multiline edit box, save the changes and see the employee notes list refreshed.

     Note: You will find that the Multiline edit box supports Find (Ctrl+F), GoTo(Ctrl+G), Replace (Ctrl+H) and Print (Ctrl+P) dialogs.