Keeping a class in step with a file's record buffer after every read and before every write

Applies to: ABC FileManager classes, posted in the Clarion 7 group; the thread names no build number.

Problem

The poster wanted a class loaded with the file record that stayed synchronised with the file buffer after every read and before every write, used like Buffer:File.Method() in place of Access:File.Method(). He planned a template that generates, per file, a derived class holding a group of references to the record fields. He asked whether this exists and whether it can be done.

Solution

The replies converged on deriving from the FileManager class:

  1. Derive one class from FileManager with derived Insert, Update, DeleteRecord, Fetch, Next and Previous methods, each calling a new SyncBuffer method.
  2. Make SyncBuffer VIRTUAL, so each file's class can derive it. The code can go in embeds by hand or be generated by a template; the reply's author had done both.
  3. Tell the global settings to use your FileManager class instead of the shipped one.
  4. For field access from a FILE parameter, see how ABFile.clw's AutoInc class saves and restores the buffer; the record is reachable as a GROUP through PROP:Record, fields through WHAT(), names through WHO().

Caveats

  • A VIEW bypasses the derived methods; call SyncBuffer after each VIEW record, in a global template for Reports and Processes, and by hand in hand-coded VIEWs.
  • RelationManager also updates and deletes records, sometimes through the FileManager and sometimes directly, so some places cannot be hooked.
  • A DCT before-trigger was proposed, but triggers fire only on insert, update and delete, not on fetch, next or previous.
  • Callbacks on the files were suggested as an easier route. The poster did not report how his template turned out.

Today (2026)

Not re-tested. The derive-and-override approach likely still works on the ABC classes; the reply warns it took months of refinement for its author.

Sources: Michael R. (Jan 2010, the question), Martin H., Paul B., Mike H. (Jan 2010) in sv.clarion.clarion7.