Question

Photo of Dan Locke

0

Print alternate to security code on tag

We have multiple children that come to our church on buses/vans. We would like, when they check in, for them all to have matching codes on their tags, so their drivers don't need a pile of pickup receipts. The kids have an attribute called "VanGroup" in which we can choose their van assignment. I want that attribute's value to print in lieu of a random security code for the kids who have been assigned a van.

I'm trying to figure out the lava for the merge field. Right now I have this:

{{ assign vanCode = Person | Attribute: 'VanGroup' }}{% if vanCode == '' %}{{ Person.SecurityCode }}{% else %}{{ vanCode }}{% endif %}

But it's not working (nothing prints on the tag in that field). Is the code even close to correct? Any suggestions?

  • Photo of Jim Michael

    0

    Your syntax is almost right, but just a few issues where you used {{ but need {% (in your assign statement).  I think this is the correct code:

    {% assign vanCode = Person | Attribute: 'VanGroup' %}{% if vanCode == '' %}{{ Person.SecurityCode }}{% else %}{{ vanCode }}{% endif %}
  • Photo of Dan Locke

    0

    Excellent! Thanks - it always seems to be the syntax that trips me up.