- In the Class Browser, select the JadeScript class.
- Select the Methods | New JADE Method... command.
The JADE Method Definition dialog is displayed.
- Enter checkOutBooks and click the OK button.
A skeleton method is created for you to code.
- Select the code on the left by clicking and dragging.
- Copy the code to the clipboard (CTRL-C).
- Select all the code in the code window (CTRL-A).
- Paste the code from the clipboard (CTRL-V).
- Select the Methods | Compile Method menu command.
The status line in the Class Browser displays
«Compilation complete - no errors»
- Select the Jade | Execute it menu command.
The status line will then display the message
«Execution complete»
Troubleshooting
If your code did not compile, an error message displays on the status line.
Click an error message to find out what to do.
Error 6050 - Cannot change name
Error 6026 - Unknown property or method
Error 6090 - Cannot access protected property or method |
checkOutBooks();
vars
brw : Borrower; // brw is of type Borrower
bk1, bk2 : Book; // bk1 and bk2 are of type Book
begin
// assign values to variables
brw := Borrower.firstInstance;
bk1 := Book.firstInstance;
bk2 := Book.lastInstance;
beginTransaction; // required for database changes
// check out the books to the borrower
bk1.myBorrower := brw;
bk2.myBorrower := brw;
commitTransaction; // update and release locks
end; |
|