Advanced Customization > Business Logic Customization > Report Generation > ReportTemplate Data Source Customization
  
ReportTemplate Data Source Customization
Objective
You want to create a new Windchill data query to use in a Report.
Background
The Windchill Business Reporting (WBR) solution uses Data Source objects to retrieve data from Windchill . One type of Data Source is a ReportTemplate. A ReportTemplate is a standard, persistent Windchill business object that is maintained via the Report Management utility. It launches the Query Builder to create and edit a query that is stored as part of the ReportTemplate. When the ReportTemplate query is executed, standard Windchill APIs are used that apply all Windchill business logic (e.g. calling Windchill object methods, applying access control, etc.). Once a new ReportTemplate object is created it can be referenced from a Report object or exposed and used in the WBR solution as a custom Data Source.
Scope/Applicability/Assumptions
This documentation assumes that the Windchill Business Reporting (WBR) solution (i.e. Cognos) has been successfully installed and configured. The Windchill instance name is referred to as <WindchillInstanceName>. The Cognos root URL is referred to as <WBRHomeURL>. Typically, if the WBR solution is installed on <WBRHost>, then the <WBRHomeURL> would be http://<WBRHost>/cognos8/cgi-bin/cognos.cgi. It is assumed that you can login to <WBRHomeURL> and you have sufficient Cognos privileges to view Windchill Data Source objects and create reports.
Assume you have access rights to create a ReportTemplate business object <MyReportTemplate> in the Site context.
For WBR integration, you must also have access rights to update the reporting meta model.
This document does not contain details on how to construct ReportTemplate queries. See the Query Builder online tutorial and help for this information.
Intended Outcome
The end result of this solution is the creation of your Data Source that can be used to author Cognos reports.
Solution
Use Report Management and Query Builder to construct a ReportTemplate Data Source.
Prerequisite knowledge
To achieve this objective, you need to have an understanding of the following:
Report Management User Interface
Query Builder User Interface
The Windchill data model for the area(s) related to the Windchill business objects that will be used in the ReportTemplate query
JConsole User Interface
Cognos User Interface
Solution Elements
Element
Type
Description
<MyReportTemplate> Windchill ReportTemplate
Windchill Object
The Windchill object that specifies a query for retrieving Windchill data.
Procedure – Creating a ReportTemplate Data Source
1. Navigate to the Windchill “Site > Utilities” and launch the Report Management utility.
2. From the Report Management UI, click “New” to launch Query Builder.
3. Create a ReportTemplate query and save. This creates a ReportTemplate business object in Windchill that can be used as a WBR Data Source.
4. Update the Cognos model to recognize this new Data Source. Launch JConsole from installed Windchill shortcuts. Connect to the Embedded Servlet Engine (based on Tomcat) JVM instance. Select reporting management bean from the MBeans tab, “com.ptc > Monitors > ReportingSystem”. From the Operations tab, click “updateModel”.
5. Verify that the Data Source exists in Cognos. Login to Cognos using the <WBRHomeURL> and launch “Report Studio”. Find <MyReportTemplate> Data Source under “Windchill > Report Templates” in the “Insertable Objects” window under the “Source” tab.
Customization Points
Procedure - Creating a ReportTemplate Data Source in a non-Site context
In the primary procedure above, the ReportTemplate was created in the Site context. The Site context in Windchill correlates to the “Windchill > Report Templates” level of the Source tab. A variation of the primary procedure is to create the ReportTemplate in a non-Site context such as an organization.
1. Assume you have ReportTemplate create access in the organization <MyOrg>.
2. In step 1, navigate to the “Utilities” page under <MyOrg> instead of the Site Utilities page.
3. In step 5, the Data Source will now be available under “Windchill > Report Templates > <MyOrg>”.
Procedure – Deleting a ReportTemplate Data Source
A ReportTemplate Data Source that is no longer needed can be removed from the system by deleting it from Windchill and updating the Cognos model.
1. Launch Report Management from the context associated with the ReportTemplate, select the object, and click “Delete”.
2. Then update the Cognos model using step 4 of the above Creating a ReportTemplate Data Source procedure.
Limitations
None.
Sample Code
Examples of Usage in Windchill Code
There is no out-of-the-box functionality that depends directly on ReportTemplate Data Source objects. However, there are several out-of-the-box ReportTemplate objects and these are available in Cognos as ReportTemplate Data Source objects. These Data Sources can be used for creating Cognos reports. However, directly modifying these ReportTemplates is not supported.
Packaged Samples
A demo ReportTemplate Data Source object, PartList, is available. It can be loaded using the following command:
wt.load.LoadFromFile -d
<WindchillHome>/loadXMLFiles/DemoReports.xml -CONT_PATH /
Note that if these objects were already loaded, exceptions may occur when running this command. The PartList ReportTemplate object is a simple query for Parts that returns two columns with part number information. It will be created at the Site context and will be available in Cognos after executing the update model operation.
Related Customization Topics
Reporting Info*Engine Task Data Source Customization
Cognos Presentation Customization
Related Package/Class Javadoc
Foundation module
wt.query.qml
Reporting module
Reporting module
com.ptc.windchill.enterprise.report
Other Related Windchill Documentation
Report Management online help (Prerequisite)
Query Builder online help (Prerequisite)
Specialized Administration
Related Websites
http://www.ibm.com/cognos/support