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:

    <description>hello</description>
    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>
    </xsl:if>
    • 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:

    18 thoughts on “Merlin – adding a property into an existing report

    1. Pingback: Merlin – Adding an option in a python/wbl report template » MacPM

    2. Pingback: Merlin – Adding a property into an existing python template » MacPM

    3. Pingback: Merlin – do a bit of magic in reports » MacPM

    4. Pingback: Merlin – do a bit of magic in reports – part II » MacPM

    5. Pingback: Merlin – do a bit of magic in reports – part III » MacPM

    6. Pingback: MERLIN – DO A BIT OF MAGIC IN REPORTS – PART VII » MacPM

    7. Pingback: Merlin – Do a bit of magic in reports – Part IX » MacPM

    8. Pingback: Merlin – Do a bit of magic in reports – Part V » MacPM

    9. Pingback: MERLIN – DO A BIT OF MAGIC IN REPORTS – PART XVIII » MacPM

    10. Pingback: Merlin – Do a bit of Magic in Reports – Part XV » MacPM

    11. Pingback: Merlin – Do a bit of magic in reports – PART XXII » MacPM

    12. Pingback: Merlin – Do a bit of magic in Merlin reports – PART XXII » MacPM

    13. Pingback: Merlin - Do a little bit of magic in Merlin reports - part XXV » MacPM

    14. Pingback: MERLIN – DO A BIT OF MAGIC IN REPORTS – PART XI | MacPM

    15. Pingback: Merlin – Do a little bit of magic in Merlin reports – part XXVI | MacPM

    16. Pingback: Merlin – Do a bit of magic in Merlin reports – PART XXIII | MacPM

    17. Pingback: Merlin – Do a bit of magic in Merlin reports – PART XXII | MacPM

    18. Pingback: Merlin – Adding a property into an existing python template | MacPM

    Comments are closed.