Pass file buffer to a class and allow field reference by name

Need something such as the following:


AClsProc  PROCEDURE(TGrp  pGrp)
  IF NOT pGrp.AField
    Do Something with some fields
    Do Something with other fields

You can loop through the group field with WHO(), then get at the data via WHAT(). But maybe it would be better to pass FILE, so you have access to blobs/memos. You can use PROP:Value and/or PROP:Record (if you want the actual record).

No blobs or memos. Only need to access current contents of the passed table buffer. Buffer would be from one of three SQL tables (ie Views) that have the exact same structure.

In that case, just pass a typed group.

MyMethod PROCEDURE(PRE:Record pRec)

There’s no problem passing a type’d group and accessing the fields by name, even in an empty member class.

But since you want to access the current buffer of the file
Do you wish to pass the values of the current buffer
or are you expecting to see changes in passed object as the file buffer changes?

Exactly what I first thought. Error is: Label in prototype not defined.
Obviously, as a standalone file, the class, which will be used in only 2 of 40 dlls, is not seeing the file definitions in the data dll.

It’s a scope thing. You can define a type GROUP in your class to use in prototype. As long as it’s structured like your record, you should be OK passing your record to it.

Understand the scope thing as the problem. Given the number of fields in the group, I was hoping for a simple way to keep the group in sync with the dct defined record. In my original post I tried to show my typed group attempts.

I keep a file, which has one row like the following for each table


In a


ctYada           CLASS,TYPE,MODULE('ctYada.clw'),LINK('ctYada')
Project_Init        PROCEDURE(*gtREC_Prj xPRJ, BOOL xReportAsShown)

in ctYada.CLW


ctYada.Project_Init   PROCEDURE(*gtREC_Prj xPRJ, BOOL xReportAsShown)
   IF xPRJ.SomeField 
      ! do stuff

As I think about this, it’s likely that the INCLUDE(‘’) will fail inside of a MEMBER() module
you’d need a MEMBER(‘MyProgram’) at which point you can see the global scope and could directly access the file buffers. Now that said, I find it quite useful to pass *gtRec_XXX around

If it’s not an issue to keep your class as generic, put the appropriate module name in the MEMBER() statement, then it will have scope of your app’s stuff.

1 Like

Or create a virtual method with scope of your tables.

1 Like

Generated file? Could come in handy elsewhere too.

This was easy to try. Compiled without error on this class but ended up bringing errors in another global class (ie Icetips Task Manager). No idea why but well worth testing further.

Interestingly I had a similar need - the need to work on tables while the structure of the table was either unknown, or little known, and the declaration of the table was out of scope.

It’s straight-forward to do, passing the Record around as a Group, or indeed passing the File structure around, and then using prop:record to assign the record to a &group.

The class grew because I wanted to do other related things, and that became the MyTable class.

1 Like

XLib could help even in its original form. Loading the structure information from existing FILEs, VIEWs and QUEUEs is just one of its feature.