QAD 2017 Enterprise Edition > User Guides > Reporting Framework > External Metadata > Implementing XML Metadata in the Report Data Source Program
  
Implementing XML Metadata in the Report Data Source Program
The report data source program should invoke the FillMetaData procedure in ReportHelper.p to create metadata at run-time from the information in the XML file. Once this is done, there is no need for any hard-coded metadata statements.
The following code sample illustrates how to invoke FillMetaData from a data source program:
 
define variable vhDS as handle no-undo.
 
for first ttReportRequest no-lock:
vhDS = dataset dsReportResults:handle.
run FillMetaData in reportHandle (
vhDS,"UserGuideSampleReportMeta.meta.xml").
 
if runReport then do:
run RunReport
(output dataset-handle phReportResults).
end.
end.
 
 
The lines highlighted in bold are the lines modified from the original code from the example in Appendix A. Recall that reportHandle is a handle to ReportHelper.p. The name of the metadata XML file in this example is UserGuideSampleReportMeta.meta.xml. It is recommended to use the following naming convention for metadata XML files:
<data source program name>.meta.xml
The input parameters to the FillMetaData procedure are as follows:

FillMetaData Parameters
 
Name
Input/Output
Data Type
Description
ihDS
Input
Handle
Handle to the report dataset — used to create default metadata records for all fields in the report dataset
icMetaDataFile
Input
Character
Name of a runtime XML metadata file — provides overrides to the default metadata values. This file is located on the appserver’s propath with “com/qad/shell/report/reports/” prepended (it should be co-located with the report proxy).
When processing each field for each temp-table in the dataset the metadata information is used to determine how these fields will be created in the report helper. If a DBFieldName is specified and is the same as the FieldName value then the CreateFieldForDBField call is made to retrieve metadata values for the specified DB field, such as an associated lookup. If a DBFieldName is specified but the DBFieldName is different then the FieldName value then the CreateFieldLikeDBField call is made, which will also populate additional values, such as the lookup. If there is no DBFieldName specified for the field then the CreateField call is made.