OOFILE | Downloads | Purchasing | Press | Services | Company Information | Soapbox | References | F.A.Q. | HOME |
Adding data to a single field is just the same as adding data to a variable -> you assign the value to the field by specifying the field on the LHS and the value on the RHS of the assignment operator. For example:
People.field1 = value1;
This is covered in the copying/cloning page.
Data is lazily instantiated in OOFILE -> this means that the data is put in cache until it absolutely has to save it (this reduces processing). If you wish to make the record's information permanent, you must declare saveRecord(). For example:
mytable.saveRecord();
Note: OOFILE can run in two modes. There is the automaticSave mode (in which you don't HAVE to specify saveRecord() and the requireExplicit mode (generally used as default as it then catches errors). The requireExplicit mode reuires you to use saveRecord(). If you don't it will return an error message.
This is related to the use of the operator>>. We can initialise a record by parsing through a stream of data for the fields we require. For now we need to specify the format of the stream for example by setting the field to be delimited by tabs. The sample in ooftst10 gives a basic rundown of this technique, simulating an input stream by first creating an output stream and passing values into that. This is then passed to an output stream that is finally passed into the actual record using the operator>>. Usually, we would just have a file that contains the record data and use this to pass the data into our table.
Adding related data is little different from adding simple field data. The only differrence is that we must specify the field by declaring the traversal path (the way in which we can reach the actual field through the other table) on the LHS. For example:
Patients.Doctor->LastName = "Li"
The field LastName is related to the record we are dealing with. The second table is likely to be a table of the doctors at a particular hospital and each doctor has a record with the name and some other details.
This is covered in the copying/cloning page.
(c) Copyright A.D. Software 1994-2000 (All Rights Reserved).
Last Updated: 9th September 2001