You can use conditional logic in Digital Passes to dynamically display different types of information on the front and back of your Digital Pass designs.
Before starting, you should be familiar with:
- Digital Passes: How to deliver Tickets to Apple and Google Wallets
-
Digital Customer Passes for Membership Purchases
What you can do with conditional logic in Passes
In Spektrix Link, you can add information to your Pass design using labels, values and custom Attribute data.
With conditional logic, you can create rules which will dynamically display different data depending on whether the information about the ticket meets the condition you set.
For example, your organisation may offer reserved and unreserved events. Instead of having to create a different Pass Template for each of these types of events, you can use conditional logic to display a Seat Name only if there is one available. If no seat name is available, you can choose to enter a custom text value to display, such as “unreserved”.
Adding conditional logic requires adding a Free Text value to your pass and populating this with a conditional logic statement.
How to add conditional logic to a Digital Pass
You can add conditional logic to the Front or Rear of your Pass Template.
To do this, follow the steps below:
-
Add a Label name.
-
For Ticket Passes, choose the Custom Free Text value from the dropdown:
-
Click on the black pencil icon to edit:
-
For Customer Passes, click on the black penci icon to edit the Value.
-
Enter your free text or conditional logic statement and
then click Save:
TIP: When entering your conditional logic, you can click the View Logic Guide hyperlink to be taken to a quick reference guide on how to create conditional logic.
IF, ELSE and END
To create a conditional logic statement, you’ll use IF, ELSE, and END.
- IF introduces the condition that the data on the ticket must meet to be displayed.
- ELSE lets you decide what will be displayed when the IF condition is not met.
- END will always go at the end of your statement to close the loop.
The values that are available to be displayed depend on your Pass. For Ticket passes, these values are the same as those available in the Pass builder. For Customer passes generated through Membership purchases, you can use these URL parameters.
For example, if you want to display the Seat Name but only if there is a Seat Name value:
- {IF:seat/name}{seat/name}{ELSE} Unreserved {END}
This statement will display the Seat Name (e.g. E11). If there is no Seat Name, then it will display the free text you have entered.
How to construct a conditional logic statement
To create your conditional logic statement, use the examples below and replace the field names in bold with the field names of your choice to create your required outcome. Take a look at the next section of this article to see all of the available field names.
TIP: Always include the curly brackets. Deleting curly brackets will cause your conditional logic to fail.
- To display a free text if any value is present, use:
{IF:seat/name}{seat/name}{ELSE} Unreserved {END}
Replace seat/name with the field name you want to display.
Replace Unreserved with the free text you want to display.
- To display free text if a specific value is present, use:
{IF:seatingPlan/venue = "My Pass Venue"} Use west car park {END}
Replace seatingPlan/venue with the field name.
Replace “My Pass Venue” with the name of your venue exactly as it appears on your system. Make sure you include the quotation marks.
Replace Use west car park with the free text you want to display if the value is present.
Attributes
Attributes can be used in conditional logic statements to display a different message on the Pass depending on the ticket’s Attribute value.
REMINDER: Attributes must have the This attribute is visible in your API integrations box checked to be available in Digital Passes.
To reference an Attribute in your conditional logic statement, you will need to follow this format:
attribute_AttributeName = “value”
For example, if you have a Seat Attribute named Entrance Door with a value of Door A:
{IF:seat/attribute_EntranceDoor = "Door A"} Use door A for access {END}
This statement will display the custom text you enter if the Attribute value of the ticket is Door A.
- Use event/attribute, instance/attribute or seat/attribute.
- For the Attribute name, remove any spaces and capitalise the first letter of each word. In this example, the Attribute is EntranceDoor.
- For the Attribute value, enter the value exactly as it appears on your system. Include any spaces and place it inside the quotation marks. In this example, the Attribute value is “Door A”.
TIP: You can layer multiple IF statements to account
for different outcomes in the same field. For example:
{IF:seat/attribute_EntranceDoor = "Door A"}Use door A for access {END}
{IF:seat/attribute_EntranceDoor = "Door B"}Use door B for access {END}
{IF:seat/attribute_EntranceDoor = "Door C"}Use door C for access {END}
Attributes for Customer Passes Generated Using Email Confirmation Orders
Adding Attributes for Customer Passes generated using Email Confirmation Orders differ.
To reference an Attribute in your conditional logic statement, you will need to follow this format:
Attributes/AttributeName=“value”
For example, if you have a Membership Attribute named PassType with a value of SeasonalPass:
{IF:Attributes/PassType = "SeasonalPass"} Seasonal Pass {END}
Do not include spaces in the Attribute Name and Values.
For Checkbox Attributes, you can use true (checkbox is checked) or false (checkbox is not checked) as the value. For example, {IF:seat/attribute_RetrictedView =true} Restricted View {END}.
Dates
In Apple Passes, sometimes the date and time fields that are displayed are reduced in size. To increase the size of the date and time fields, you can use conditional logic to display date and time in one column.
To include Date and Time in your conditional logic statement, use:
{formatDate(instance/startDate)}{formatTime(instance/startTime)}
The format will match your current date format configuration.
Field Names
TIP: These field names are for use in Ticket Passes. For the custom fields and URL parameters in Digital Customer Passes generated through Membership purchases, read the article Digital Customer Passes for Membership Purchases.
You can use the heading/subheading format to reference specific field names in your conditional logic statements.
- Enter all field names which are one word in lower case.
- If the field name has two words, then the second word should start with a capital letter and no space. For example: infoLabel.
Use the table below to reference how to include each available field name:
| Field Name Reference |
| ticket/ticketType |
| ticket/barcode |
| ticket/price |
| ticket/bandName |
| ticket/totalCharge |
| ticket/discount |
| ticket/offer |
| instance/startDate |
| instance/startTime |
| seat/name |
| seat/infoLabel |
| seatingPlan/name |
| seatingPlan/areaName |
| seatingPlan/venue |
| seatingPlan/venueAddress |
| order/salesChannel |
How to test your conditional logic
To test how the Conditional Logic on your Pass will be displayed, use the Get Sample Data button to preview the Ticket Pass or preview the Customer Pass.
You should test all of the different outcomes of your conditional logic statement to check that it displays as you intend.