Advanced Customization > Business Logic Customization > Report Generation > Import and Export of Report Templates
  
Import and Export of Report Templates
 
Two command line utilities are available for import and export of report templates to and from the database. The import utility, LoadReportTemplate, can be used in a standalone manner or from within wt.load.Demo. The export utility, ExportReportTemplate, is available in standalone mode only.
* 
Individual report templates can be imported and exported using the Import and Export actions available from Report Management. For more information, see the help available from Report Management.
The LoadReportTemplate utility persists report template objects to the database based on input from an XML file. In this file, each report template object is defined in a csvReportTemplate element. The content of these elements are defined as follows:
csvReportTemplate element
Description
csvfolder
Required. This entry is the location of the report templates in Windchill Explorer. If the specified folder does not exist, one is created.
csvname
Required.
csvdescription
Optional.
csvxml
Required. This entry specifies a path to the XML source file. This file is parsed and then validated against the QML DTD (<Windchill>/codebase/wt/query/qml/qml.dtd). The path is first assumed to be an absolute file path. If the file is not found, the path is then assumed to be relative to the <Windchill>/loadFiles directory.
csvxsltype
The XSLT designation; possible options include the following:
DEL (delegation), which allows selection from a set of defined XSLT formats.
URL, which offers selection of a customized XSLT stylesheet.
No entry, which requires the user to select a format style at report template generation time.
csvservice
If the XSLT designation is DEL, this column is required. The formats currently available are as follows:
HTML
CSV
TSV
XML
PDF
HTMLWithSorting
HTMLWithMerging
MSWord2000Portrait
MSWord2000Landscape
csvContainerPath
Optional. This column specifies a container where the report should be stored. If no value is specified, the site container is used by default.
csvurl1
If the XSLT designation is URL, this column is required and should contain a URL pointing to a customized XSLT stylesheet.
csvurl2
This column is used only if the XSLT designation is URL and, even then, is optional. It defines a second URL location for an XSLT stylesheet.
csvinputPage
Optional. This entry specifies an input page for the Report.
csvresourceBundle
Optional. This entry specifies a resource bundle for the Report.
An out-of-the-box XML file, reporttemplates.xml, is provided along with several sample XML source files. These XML files are used for persisting sample report templates during wt.load.Demo. The reporttemplates.xml file is located in <Windchill>/loadFiles and the sample XML files are located in <Windchill>/loadFiles/reports.
There are three options for using the LoadReportTemplate utility in standalone mode:
java wt.query.template.LoadReportTemplate
No parameters indicate that the default sample files defined earlier are being used.
java wt.query.template.LoadReportTemplate c:\loadReports.xml
The parameter indicates the absolut path of a user-defined XML file.
java wt.query.template.LoadReportTemplate loadReports.xml
The parameter indicates the relative path of a user-defined XML file.
The ExportReportTemplate utility downloads multiple, persisted report template objects from the database to the relative file exportreports.xml. This file has the same structure as defined above.
The ExportReportTemplate utility has three optional parameters:
The first parameter specifies a string to use to search for report template objects by name. The "%" symbol can be used as a wildcard to match any number of characters in the name. If this parameter is not specified, all report template objects are exported.
The second parameter specifies the path of the container in which to search. If this parameter is not specified, the site container is searched to find the report template.
The third parameter specifies whether the container should be searched hierarchically. If the value is true, the criteria will match the specified container or any of its parent containers. If the value is false, only the specified container will be matched. If this parameter is not specified, a value of true is used.
The following example exports all report template objects in the site container that have a name starting with the characters "monthly":
java wt.query.template.ExportReportTemplate monthly%
The following example exports all report template objects in the Windchill PDM library, the DefaultOrg organization, and site containers that have a name starting with the characters "monthly":
java wt.query.template.ExportReportTemplate monthly%
"/wt.inf.container.OrgContainer=
DefaultOrg/wt.inf.library.WTLibrary=Windchill PDM"
The following example exports all report template objects in the Windchill PDM library that have a name starting with the characters "monthly":
java wt.query.template.ExportReportTemplate monthly%
"/wt.inf.container.OrgContainer=
DefaultOrg/wt.inf.library.WTLibrary=Windchill PDM" false