Monday, January 13, 2014

What is a table buffer?

This probably seems like a very simple topic, however, that is what we are about here!  I was thinking about this yesterday and wondered what a table buffer REALLY is!  

CustTable custTable;

Declaring a table buffer is relatively simple and straightforward.  We can also populate that table buffer with all the records in CustTable by doing the following:

select custTable;

We now have all the CustTable records in our custTable buffer.  It is important to note that until you perform this step, custTable has NOTHING in it.  You must select records into the buffer to be able to work with them.  
Once selected, you could have more than 1 record, however, only 1 of the records will be the 'active' record in the buffer.  That means when you go to retrieve and/or set information in the record, it will be from the 'active' record.

activeRecordAccount = custTable.AccountNum;
custTable.Account = 123456;

It's important to make sure you have working with the record you want before you change it.

In summary, what is a table buffer?  I'm not sure I have an exact definition of what it is, however, a co-worker gave me the following definition:

"A class that points to a selection of records with up to one 'active' record at a time."

I think this summarizes it pretty well!  Feel free to comment or criticize!






No comments:

Post a Comment