Printing different numbers of labels at check-in

  • By Michael Garrison 4 Months Ago

A church asked recently for the ability to change the number of a specific label that prints at check-in. Specifically, since the most Rock is designed to do is to print one label per person, they wanted to be able to have a "Notes" tag printed for every location > schedule every person checks into.


This is the desire we're meeting in this article, but you could also imagine expanding on this idea to print a certain number of other labels - perhaps an arbitrary number of labels for things like diaper bags and bottles, for instance, based on the value of a Person Attribute....


Here's the key: the merge fields look for ^FD, followed by ^FS, and substitute any text between those tags with the contents of your corresponding merge field. AND Zebra printers ignore ^FD and ^FS tags which occur outside the "begin tag" and "end tag" commands (^XA and ^XZ)


So ... we're going to create an entirely blank label that ONLY has a single merge field. Then we're going to create a huge merge field to stick in there, that actually contains an entire label, inside of a loop.


First, we need to create a merge field in Rock which will hold our "per user, per service" note label in its entirety.


Go to "Admin Tools -> Check-in Configuration -> Label Merge Fields". Add a new merge field. I was super descriptive and called it "Note label per person/service", but name yours as you see fit. I also used the description of "A complete note label, for each service, for each person" so that I don't accidentally use it in the merge field of a "regular" label.


Here's the MergeField content:

{% for schedule in Location.Schedules %} 
^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR6,6~SD15^LRN^CI28^XZ
^XA
^MMx
^PW812
^LL0406
^LS0
^FT607,68^A0N,73,72^FB177,1,0,R^FH\^FD{{ Person.SecurityCode }}^FS
^FT6,122^A0N,39,38^FH\^FD{{ Person.NickName }} {{ Person.LastName }}^FS
^FT8,194^A0N,34,33^FB57,1,0,C^FR^FH\^FD{% assign personAllergy = Person | Attribute:'Allergy' -%}{% if personAllergy != '' -%}A{% endif -%}^FS
^FB330,3,0,L^FT427,168^A0N,25,24^FH\^FD{{schedule.Name}}^FS
^FT12,297^A0N,34,33^FB48,1,0,C^FR^FH\^FD{% assign personLegalNotes = Person | Attribute:'LegalNotes' -%}{% if personLegalNotes != '' %}L{% endif %}^FS
^FB330,4,0,L^FT68,250^A0N,23,24^FH\^FD{% assign personAllergy = Person | Attribute:'Allergy' %}{% if personAllergy != '' %}{{ personAllergy | Truncate:100,'...' }}{% endif %}^FS
^FB330,4,0,L^FT68,354^A0N,23,24^FH\^FD{% assign personLegalNotes = Person | Attribute:'LegalNotes' %}{% if personLegalNotes != '' %}{{ personLegalNotes | Truncate:100,'...' }}{% endif %}^FS
^FT421,212^A0N,23,24^FH\^FDNotes:^FS
^FO403,154^GB0,237,1^FS
^FO422,386^GB361,0,1^FS
^FO423,345^GB361,0,1^FS
^FO421,304^GB361,0,1^FS
^FO421,263^GB361,0,1^FS
^LRY^FO0,0^GB812,0,81^FS^LRN
^PQ1,0,1,Y^XZ
{% endfor %}

What you're looking at is a complete label, defined inside of the for loop.


The next step is to create a label that will use this.


Under "Admin Tools -> Check-in Configuration -> Check-In Labels", you want to add a new label. Give it a name, a description, and a MIME type of "Text/Plain". Then click Save without bothering to upload a file or mess with the merge fields. Now, find your new label in the list and click on it to get into the "Edit Check-In Label" dialogue. Now click the "Edit Label Contents" button in the bottom right corner and you'll be taken to a screen with a blank "Label Contents" box. Here's the code you paste into that box:

^FD1^FS 

That creates a single merge field called "1". Nothing else.

Click Save, and then you'll be back on the "Edit Check-in Label" screen. Click "Reload Merge Fields" in the bottom right corner, and you'll see "1" populate as a merge code. Use the drop-down to select your complete note label merge field that we created earlier.

VariableQuantityLabelConfig.PNG

Click Save.


Finally, we're ready to assign the label to your check-in area.

Under "Admin Tools -> Check-in -> Check-in Configuration, click the configuration containing the area you want to add the label to (usually the "Weekly Service Check-in Area). Now select the check-in area you want to add the label to. Remove the default "Note" label and add in its place your "Variable Quantity Note Label".

LabelConfig.PNG

Click "Save" and that's it (though you may need to add the label to more than one area, depending on your setup). Go test your check-in by checking someone into that area for multiple services (such as test 4:00 and test 6:30), and you should get a separate label for each service.


Appendix

OK, so we've given you a complete label for use if you want to do this just for the notes label. But what about other labels?

Start making your merge template by copying the complete contents of the label you want duplicates of. Put it in a loop or a conditional based on how you want to determine the number. Then, go through and for every merge field (WWW for the security code, 1 for name, etc) delete the merge field name and replace it with the actual contents of the merge template you'd usually link to that field.

So, if you have a field like 

^FT452,119^A0N,135,134^FB333,1,0,R^FH\^FDWWW^FS

for your security code, take WWW out of it (the part between ^FD and ^FS) and replace it with the Security code Merge Field ( which is {{ Person.SecurityCode }} ) Your resulting security code line will thus be

^FT452,119^A0N,135,134^FB333,1,0,R^FH\^FD{{ Person.SecurityCode }}^FS

Repeat for every merge field down your label, and that's it!


Well...almost. There is some special undocumented trickery in the check-in routine that removes inverse blocks (such as ^FO12,264^GB48,42,42^FS on the default note tag...they always start with ^FO) if there's no content inside them. Since we're bypassing that normal logic, you'll need to either take out those fields and just display the A or L as black text instead of white text in a black box, or else come up with Lava to do that yourself.


@mikejed
Spark Development Network
Flagstaff, AZ

Michael Garrison recently left his job in Architecture to become one of the "new guys" at Spark (the "Core Team"), but he's still helping out Christ's Church of Flagstaff and other non-profits with tech needs in his off-hours, trying to make computers do what computers do best, so that people are freed to do what we do best: relate with people!