Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Database Access : Fetching field lists : Avoiding implied field list entries
 
Avoiding implied field list entries
Under certain conditions, the AVM adds fields to a specified field list when they are required by the client to complete the record selection. The most common case is when you specify a join condition with the OF option and you do not include the join field in the field list:
FOR EACH Customer FIELDS (Name),
  EACH Invoice FIELDS (InvoiceNum Amount) OF Customer:
  DISPLAY Customer.Name Customer.CustNum Invoice.InvoiceNum Invoice.Amount.
In this case, the AVM adds Customer.CustNum to the list because the client requires it to complete the join between the Customer and invoice tables.
However, never rely on implied entries in a field list to provide the fields you need. If you reference an unfetched field, the AVM raises the ERROR condition at runtime. Future versions of OpenEdge might change the criteria used to distribute record selection between the client and server. Thus in the previous example, if the server does not return Customer.CustNum to the client to complete the join, the DISPLAY statement executes with ERROR. This might happen, for example, if the DataServer you use or a future version of OpenEdge actually completes the specified join on the server.
Therefore, always specify all the fields you plan to reference in your field lists. There is no extra cost for specifying a field that the AVM can also add implicitly.