In our last post in this series, we have shown how to enter a new property in a report and how to proceed if not knowing its exact property name. The method shown there applies for XSTL reports. Now we can show a method for python / wbl reports.
1. Insert a property into an existing XSLT report template.
2. Insert a property into an existing python / wbl report template
Let’s suppose you have created a copy of the existing Classic Report (similar to what we have explained here) which is a python/wbl report template and want to add an option to enable the display of some additional columns in the outputted table. For example: “In project since” for the Resources, or “Category” in Issues.
If you want to have it optional, you add new options in the info.plist and insert them in your python class (as explained here)
1. Example – Resources
- You open the wbl file of your report package (as found under /Contents/Resources/)
- Locate the rows outputting the table header for Resources and copy the row with the title header
- Insert a new row for your “In project since” and change it as follows:
<th><wbl:MERClassicReportColumnHeader title="In project since" key="title" sortDescriptors=resourcesSortDescriptors /></th>
- Now go in the repetition area and copy one of the outputing rows for example the one for the title
- Paste in the right position (in the same order as your new header was entered)
- Replace the ‘title’ by ‘description’:
<td><wbl:String value=iterItem.description /></td>
- Save your changes in the wbl file.
- Open your project and call a report by your just edited report.
- See the Resources listing an extra column with a very technical information.
- Copy the text from one cell and insert in a text editor to be able to view it better.
Note: You will see there among other information of the current element in the iteration a value pair for expectedStartDate.
Now you know that you need to output this property
- So you edit your wbl file and replace the ‘description’ by ‘expectedStartDate’: thus
<td><wbl:String value=iterItem.expectedStartDate /></td>
- You can now refresh your report.
- And define a better formatter
<td><wbl:String value=iterItem.expectedStartDate dateFormat=dateFormat /></td>
Note: This report allows you to sort by clicking the headers. To allow your resources to be sorted by the expectedStartDate…
- You edit the header and insert expectedStartDate as sorting key:
<th><wbl:MERClassicReportColumnHeader title="In project since" key="expectedStartDate" sortDescriptors=resourcesSortDescriptors /></th>
2. Example – Issues
- You work similar to the explanation above with the difference that you enter a header and a row in the Issues area.
- You also call there the description in an iteration to see the values and the property names you are getting on the selected object.
- Use your report with your issues
- Check the description of the iterated object and note that there is a category element in it.
- You may change your report to output:
- Save your changes an refresh the report
- You see it contains a title property.
- Now you can correct your report to output category.title of your issue:
- Save your wbl and refresh your report
- Repair the key in the header area, to be able to sort by “category.title”:
<th><wbl:MERClassicReportColumnHeader title="Category" key="category.title" sortDescriptors=issuesSortDescriptors /></th>
- Save your wbl
- And refresh your report
- Modifying existing reports
- Edit description or report template names
- Creating your own report templates
- Localize a Merlin report template
- Further tips for localizing an XSLT report template
- Adding an option in a report template – example for xslt report
- Adding an option in a python / wbl report template
- Adding a property into an existing report (xslt)