QAD 2017 Enterprise Edition > User Guides > Reporting Framework > External Metadata > Generating Metadata XML Files
  
Generating Metadata XML Files
The MetaDataUtility.p program, which generates the two XML files, is invoked by a custom program that must be written. This program must include a copy of the report data set and call the MetaDataUtility.p program. An example program is shown below; its data set definition was copied from the example data source program in Appendix A.
 
/* Report data set 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)
.
 
define variable vhDS as handle no-undo.
vhDS = dataset dsReportResults:handle.
run com/qad/shell/report/MetaDataUtility.p(
vhDS,
"UserGuideSampleReportMeta",
"so_nbr,so_cust,so_ord_date").
 
The report dataset used in this custom program is copied from the report data source program.
MetaDataUtility Parameters
The call to the MetaDataUtility.p program has the following parameters:

MetaDataUtility Parameters
 
Name
Input/Output
Data Type
Description
ihDS
Input
Handle
DataSet handle to the report dataset — used to define default metadata settings for all of the fields
icBaseFileName
Input
Character
Base file name — specifies the base part of the generated XML file names. The runtime file, containing only the metadata for the specified field list is created as {basename}.meta.xml. The file containing the default metadata values for all the fields in the report is created in {basename}.meta.all. This latter file is generated for reference in case additional fields need to be added to the runtime XML file, to add additional search criteria, for instance.
icSearchableFields
Input
Character
Field list — specifies the list of fields which will be included as searchable fields in the runtime XML file. Note that the order in which these fields are specified in the list determines the order that they are generated, along with their criteria sort order, in the resulting XML file.
Metadata XML Elements
The specification for these metadata XML files is as follows:

Metadata XML Elements
 
Element
Required
Default
Data Type
Description
dsReportMetaData
Yes
N/A
N/A
Outermost root element.
BufferName
Yes
N/A
N/A
Outer element for each field metadata specification.
FieldName
Yes
N/A
String
Name of temp-table in report’s dataset
FieldLabel
No
“”
String
Name of field for temp-table in report’s dataset. The values for FieldLabel elements will be treated as translated label keys. If no corresponding label is found for the key, then the key itself will appear. For example, the term “SITE” should get translated in English to “Site.”
DBTableName
No
“”
String
Specifies the DB table name associated with this field.
DBFieldName
No
“”
String
Specifies the DB field name associated with this field.
DBFieldExtent
No
0
Integer
Number of elements in an array DB field. Set to 0 if not an array field.
IsSearchField
No
False
Logical
Determines whether this field is to be used for filter criteria.
ValueList
No
“”
String
Comma separated set of {term},{return value} pairs used to define selections for a filter field. The values ValueList elements will be treated as translated label keys. If no corresponding label is found for the key, then the key itself will appear. For example, the term “SITE” should get translated in English to “Site.”
IsReadOnlySearch
No
False
Logical
Specifies that this filter constraint cannot be modified.
IsVisible
No
True
Logical
Whether this field can be displayed
IsOperatorChangeable
No
True
Logical
Whether this filter field's operator can be modified by the user.
IsRequiredCondition
No
False
Logical
Specifies whether user must enter a constraint for this filterable field.
IsEditable
No
True
Logical
Whether this filter field's constraint can be modified.
DefaultValue1
No
“”
String
Default value for first filter criteria setting.
DefaultValue1Type
No
“constant”
String
The type for the first filter criteria.
DefaultOperator
No
“equals”
String
The default operator for a filter field.
DefaultValue2
No
“”
String
Default value for second filter criteria setting.
DefaultValue2Type
No
“constant”
String
The type for the second filter criteria.
An example of an XML file is provided below:
 
<dsReportMetaData>
<ttField>
<BufferName>ttSalesHeader</BufferName>
<FieldName>so_nbr</FieldName>
<FieldSequence>1</FieldSequence>
<DBTableName>so_mstr</DBTableName>
<DBFieldName>so_nbr</DBFieldName>
<IsSearchField>true</IsSearchField>
</ttField>
<ttField>
<BufferName>ttSalesHeader</BufferName>
<FieldName>so_cust</FieldName>
<FieldSequence>2</FieldSequence>
<DBTableName>so_mstr</DBTableName>
<DBFieldName>so_cust</DBFieldName>
<IsSearchField>true</IsSearchField>
</ttField>
<ttField>
<BufferName>ttSalesHeader</BufferName>
<FieldName>so_ord_date</FieldName>
<FieldSequence>3</FieldSequence>
<DBTableName>so_mstr</DBTableName>
<DBFieldName>so_ord_date</DBFieldName>
<IsSearchField>true</IsSearchField>
</ttField>
</dsReportMetaData>
 
Note: The elements must be provided in the order identified in the previous table, but intermediate optional elements need not be provided. Any missing elements will result in the default value being used as specified in the previous table.