Question

Photo of Jeremey Schrack

0

Report Generation Using Merge Templates

 I am quickly discovering the power of merge templates.  In the system that we are moving from we had the ability to run reports based on various different data models.  I have been experimenting with using the Merge Templates to create mailing lists from groups, dataviews, and even reports.  I have had great success in getting the row data, however there is one issue that I keep coming up on.  Is it possible to pull the name of the record set that is being merged.

Here is what I mean.  We have deacons that have individual families assigned to them, so we created groups to manage these lists for each deacon.  Now, we need to be able to print reports monthly for the deacons so they can have an updated assignment list.  The data is exported fine, but I want to be able to generate the group name on the template.  I tried the {{ group.name }} token found in the attendance merge template but that wasn't working.

 I tried doing {{ context | ToJSON  }} and {{ row | ToJSON }} to quickly see if the information is nested somewhere in those data sets, but it is not.

This seems like it should be relatively easy, if I only knew where/what to look for. 

  • Photo of Michael Garrison

    0

    Jeremy,

    You had the right idea, but the place you need to look for everything that's available is on the merge screen itself: if you choose to Show Merge Fields click "Row" and scroll (way) down, you'll see that under GroupMember there's an item for Group which includes the property of Name

    That means that if you include {{ Row.GroupMember.Group.Name }} in your merge template, it will get the group name you're looking for. (if you get there before the site resets tonight, you can Mail Merge a group in http://rock.rocksolidchurchdemo.com using the Groupname Name Tags (Avery 5395) that I made based on the Name Tags (Avery 5395) template ... it works! (see below, and understand that {% Next %} is simply not visible after {{ Row.GroupMember.Group.Name }} in the template as it scrolled below the bottom border of the nametag. It's there ;-)

    For future reference, I'd note that the easiest way to find whether a piece of data is readily available to your merge template is to expand Row and then use your browser's Find function (usually Ctrl+F) to search for what you know the value to be- in this case I was using a merge template on the "Ushers" group so I searched for Ushers and then went back up the outline format to get the list of properties I needed to use).

  • Photo of Jeremey Schrack

    0

    Thank you for the information.  This will work great in other applications.  What I did instead was create  a page that lists the groups (Deacon Families) and then created a custom block that does two things.  It merges to a template configured in the block settings and then combines the families using the current group ID to do the lookup(combination of the GroupAttendanceDetail block and MergeTemplateDetail block) to accomplish everything I needed.

     Thank you for the assistance.