Authoring Jasper Report Using Windchill REST Services End Points (GET Method)
Configuring Jasper Studio
• Before you start designing the Jasper report, ensure that the machine where Jasper reports are authored is added as the trusted host in Windchill. Add the following entry is to be added to <WT_HOME>/codebase/wt.properties file.
• Execute the following command from a Windchill shell:
windchill com.ptc.util.wbr.export.ExportDataSource wrs
This command creates the DataSource JAR at $(wt.temp)/DataSources/WRS.
• Add the JAR to the plugin directory of the Jasper Studio. If you are using Eclipse’s JasperSoft Studio Plugin, add the jar to the Eclipse’s plugin directory.
cp $(wt.temp)/DataSources/WRS/wrsDataSource*.jar <PluginDirectory>
• Restart the Jasper Studio/Eclipse.
Authoring the Report
1. Create a new JasperReports project.
2. Click Jasper Report option. Provide a name to the Jasper file. Click Next.
3. On the New Report Wizard, select the parent folder. Select the report file name with .jrxml extension. Click Finish.
4. On the Data Source panel of the New Report Wizard,select One Empty Record – Empty rowsoption and click Finish.
5. Verify that the project Outline does not have Fields at this stage.
6. Drag > element on the details area of the Design editor.
7. On the Dataset panel of the Table Wizard, you have option to create a dataset from a selected source, Select Create new dataset from a connection or Data Source to specify the dataset name. Click Next.
8. On the Connection panel of the Table Wizard, select Use a JRDataSource expression. Click Finish. The JRDataExpression format is:
com.ptc.wbr.datasource.WRSJsonDataSource.getJsonDataSource(<WRS Endpoint>,<selectExpression>)
◦ WRS Endpoint—A string representing the JSON data source. It is the WRS EndPoint that returns the JSON response.
WRS Endpoint must be in the below format:
$P{WRS_URL}+"/ProdMgmt/Parts?wt.effectiveUid="+$P{USERNAME}
Where,
▪ WRS_URL and USERNAME are the parameters, which can be created in Jasper Studio.
▪ /ProdMgmt/Parts can be changed depending on required WRS module.
◦ selectExpression—A string representing the selected expression.
The selected expression is optional. You may provide any selected filter as the second parameter to the method getJsonDataSource.
9. Create fields for Table.
10. Drag these fields to the table.
11. Generate the report.