SET FIELDS example
This example takes a table of customers and a table of sales persons and creates a table that contains only the customer name and the name of their sales representative.
use CUSTOMER in select( )
use SALESPER in select( ) order SALES_ID
select customer
set relation to SALES_ID into SALESPER
set fields to CUST_NAME = CUSTOMER->NAME, SALES_PERS = SALESPER->NAME
copy to CUSTSALES
The field list contains two calculated fields that are used simply to assign new names to the fields from two different tables that happen to have the same name.
Although the COPY command has a FIELDS option, it does not support calculated fields. Therefore SET FIELDS is required for this operation.