Display a field only if it matches a condition

Display a field only if it matches a condition

You can show or hide a field on a pass based on a condition. You write the condition with the syntax below, and Passcreator checks it when it creates or updates the pass.

Where to add a condition

Edit the field in the template editor and open Extended options. Enter your condition in the condition field.

Conditions tolerate small differences. Extra spaces around an operator are fine, and you can wrap a string in single or double quotes.

Combine conditions with &&. The next example matches when the level is Silver and the interest contains food or travel.

{Level} == Silver && {interest} |= food,travel

Show a field only when a property has a value

Enter the placeholder on its own to show the field only when the property is not empty.

{Fieldname}

That is the same as comparing it to an empty string.

{Fieldname} != ''

Match a specific value

Show the field only when a property holds a certain value.

{Level} == 'Silver'

Match anything except a value

Show the field only when a property does not hold a certain value. Both lines below do the same thing.

{Level} != 'Silver'
{Level} <> 'Silver'

Match when a property contains a value

Use |= to match when the property contains one of several values. Separate the values with a comma. The next condition matches when the field contains food or travel or both.

{interest} |= food,travel

Match on the time the pass was generated

The now() function checks the moment the pass was created or updated. A phone that receives an update recreates the pass, and that is when Passcreator checks the condition again.

The next condition adds the field only for passes generated after 15 October 2023 at 15.00 and before 31 December 2023 at 23.59. Anyone who downloaded the pass outside that window does not see the field. Send an update on 1 January 2024 and the field drops away.

now() > 2023-10-15 15:00 && now() < 2023-12-31 23:59

Match on the operating system

Show a field only in Apple Wallet on iOS.

{operatingSystem} == 'iOS'

Show a field only on Android phones.

{operatingSystem} == 'Android'

Related articles

  • Personalisation
  • Create a template
    • Related Articles

    • Personalisation

      Additional properties personalise your passes. You define the fields that change for each holder, then use them anywhere on the pass as placeholders. When you create a pass, Passcreator asks for those values and fills the placeholders with the real ...
    • Segmentation using Quick Filters and Segments

      Segments group your passes by criteria you choose. Use them to find a subset of passes fast and to send notifications to everyone in that subset. Segments are dynamic, so a new pass that matches the criteria joins the segment automatically. Filter ...
    • Getting Started with Passcreator

      Passcreator is a no-code tool for creating, distributing, managing and analysing digital Wallet passes for Apple Wallet, Google Wallet and Samsung Wallet. New here? These three short reads get you productive fast. Start here Article Read it to… ...
    • Create a digital business card using a Wallet pass

      You can build a digital business card as a Wallet pass. The card holds the person details, and a QR code shares them as a vCard that a phone reads into contacts. This guide walks through the template. Create the template Create a new template and ...
    • Bulk operations (Processes)

      A process creates or updates many passes from a single CSV file. Every line in the file becomes one pass. You find these jobs under Processes in the left menu, and you start one from a template. Start a process Open the template you want to use and ...