Using BUFFER-COPY and BUFFER-COMPARE with a ProDataSet
The ATTACH-DATA-SOURCE method defines some of the same elements, such as a pairs-list for field mapping, as a BUFFER-COPY statement. The FILL method then uses these definitions to copy database fields into the ProDataSet temp-tables. Since this behavior has been extended to support ProDataSets more effectively, there are also equivalent extensions to the behavior of the BUFFER-COPY and also the BUFFER-COMPARE methods on a buffer handle.
In the optional pairs-list argument of a BUFFER-COPY or BUFFER-COMPARE method, you can now specify an array element as one or both of the fields to map. This allows you to instruct the AVM to copy a field or array element from one buffer to a field or array element in the other buffer, when the two fields do not have the same name. Previously, you could not specify an array element as one of the fields in the pairs-list. This enhancement is universally available to these two methods (though not to their static statement counterparts).
The second enhancement is specific to ProDataSet usage. It is often necessary to write BUFFER-COMPARE or BUFFER-COPY methods in custom code for FILL or update-related event logic. Because the ATTACH-DATA-SOURCE method already allows you to define a field mapping between the Data-Source buffer and the ProDataSet temp-table buffer, as well as to define a list of fields to include or exclude from the operation, it should not be necessary to specify those in a BUFFER-COPY or BUFFER-COMPARE method between the same two buffers. Therefore, the AVM checks whether a BUFFER-COPY or BUFFER-COMPARE method satisfies these two requirements:
It is between a buffer on a Data-Source table and the corresponding temp-table buffer in a ProDataSet. (Note that this means that the operation can use a different buffer for the Data-Source database table but only the default buffer for the ProDataSet temp-table.)
There is no except-list and no pairs-list in the method's arguments. (Note that the two methods do not support an include-list in any case—this optional argument is a ProDataSet enhancement for the ATTACH-DATA-SOURCE method only.)
If these two requirements are satisfied, then the method uses the pairs-list from the ATTACH-DATA-SOURCE method for the Data-Source, if any, along with either the except-list or the include-list, if any, to determine what fields to copy or compare. This works in both directions, so in the expression hFromBuf:BUFFER-COPY(hToBuf) or hFromBuf:BUFFER-COMPARE(hToBuf), either hFromBuf or hToBuf can be the Data-Source buffer, and the other the temp-table buffer. This saves you from having to repeat the field-mapping from the ATTACH-DATA-SOURCE method in a BUFFER-COPY on the same buffers.