QAD 2017 Enterprise Edition > User Guides > Reporting Framework > Implementing a Progress Data Source Program > Developing the Data Source Program Code > Data Set Definition Block
  
Data Set Definition Block
The following code block from a sample program illustrates how to define a data set and its temp tables. A dataset may contain multiple temp-tables, which often have relations between them. In the following example, we create a data set with two simple temp-tables that have a master-detail relationship:
/* Temp-table definition block */
define temp-table ttSalesHeader no-undo
field so_nbr like so_mstr.so_nbr
field so_cust like so_mstr.so_cust
field so_ord_date like so_mstr.so_ord_date
field sales_order_slspsn1 like so_mstr.so_slspsn[1]
field sales_order_slspsn2 like so_mstr.so_slspsn[2]
field sales_order_slspsn3 like so_mstr.so_slspsn[3]
field sales_order_slspsn4 like so_mstr.so_slspsn[4]
index SalesHeaderIdx is primary so_nbr
.
define temp-table ttSoLine no-undo
field sales_order_number like so_mstr.so_nbr
field sales_detail_line like sod_det.sod_line
field sales_detail_item like sod_det.sod_part
field sales_detail_qty_ord like sod_det.sod_qty_ord
field sales_detail_unit_measure like sod_det.sod_um
field sales_detail_due_date like sod_det.sod_due_date
index SoLineIdx is primary sales_order_number sales_detail_line.
.
define dataset dsReportResults for ttSalesHeader, ttSoLine
data-relation drLine for ttSalesHeader, ttSoLine
relation-fields (so_nbr, sales_order_number)
 
Note: If you want to use some fields in the temp-table as search fields, you must use the same field names in the temp-tables as those in the database.
Note: Indexes specified for the temp tables can be used to define unique constraints and the default sort order of the records.
Note: There must be a dataset named dsReportResults defined for temp-tables for the program to work, even if they have no relations.
Note: The use of Progress array fields (extent fields) is not supported in report data set temp tables. Instead, you can define several individual fields to hold the elements of the array. In the above example, this was done to handle the array so_mstr.so_slspsn[].