Merlin – adding a property into an existing report

We have explained how to add options in your Merlin report templates and control the content of the outputted data. In our examples we define an option to be able to disable a known property,  but how to proceed if you want to add the values of a property in your report and don’t know its actual name? This post will try to give some tips on this. For reasons of simplicity we differentiate between XSTL report templates, and templates based on  python / wbl:

1. Insert a property into an existing XSLT report template.
2. Insert a property into an existing python / wbl report template

1. Insert a property into an existing XSLT report

Let’s suppose, you have a copy of the existing “Next Due Activities” report (as explained here) and want to add an option to enable the “Notes” column in the outputted table.

Your workflow

  • You add a new option with the name withNotes as explained here in the info.plist
  • Edit the Report.xslt in your language folder and define
    param name="withNotes"
  • You enter in the table header area the display of the “Notes” header depending on the value of the $withNotes:
<xsl:if test="$withNotes = 1"><th>Notes</th></xsl:if>
  • Open your project in Merlin and call your report: File > New Report… > <select your own Next Due Activities report> and see which rows get outputted.
  • To find what to enter in the table iteration and get the value of the “Notes” column, type some text in the notes of an activity which is currently outputted in the report and is easy to identify; “hello” for example.
  • Save your project
  • Refresh your report
  • Ctrl click the outputted report and select “Open XML file in external editor” 
  • Do a search for your just entered notes string.
  • You will see it within the following tags and placed in an <Activity> dictionary:

    So now you know: To get the Notes value you need to ask the value of description when iterating the activities.
    • So you insert the following in the two table iterations
    <xsl:if test="$withNotes = 1">
         <td width="18%"><xsl:value-of select="description"/></td>
    • Save your Report.xslt
    • And refresh the report in the Report window.

    Note: When asking the properties of the current iteration you ask directly its properties (tags). If you need to ask a property of a dictionary in a higher level, for example of the group containing the task, you ask ../description. If you need to ask the contents of a deeper element of the current task, you can call ./description

    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.

    See next post


    Related Posts: