Skip to main content
All CollectionsTemplatesTips & tricks
Set up templates for multiple events
Set up templates for multiple events

Create contracts/ invoices for multiple dates or artists

Geertje avatar
Written by Geertje
Updated over 2 months ago

Using For Loops to Display Multiple Events in Contracts and Invoices

In ABOSS, you can use a for loop to display multiple events in your contracts or invoices. This loop will go through each event you've added and output the relevant details for each one.


Table of Contents

  1. Setting Up a For Loop for Events

  2. Using Tags Within the For Loop

  3. Closing the For Loop

  4. Example of a For Loop for Events

  5. Displaying Deal Items with a For Loop


1. Setting Up a For Loop for Events

To display multiple events in your contract or invoice, you can use the following code to open a for loop:

{% for e in events %}

This code tells the system to loop through each event that has been added to the contract or invoice.

2. Using Tags Within the For Loop

Within the for loop, you can use the same tags as you would normally use for events, but you need to add the prefix 'e' to reference each event in the loop. For example:

  • Instead of using {{ event.start }}, you would use {{ e.event.start }} inside the loop.

This prefix allows you to access the properties of each event individually.

3. Closing the For Loop

At the end of the loop, be sure to close it with the following tag:

{% endfor %}

This tells the system where the loop ends.

4. Example of a For Loop for Events

Here’s an example of how to use a for loop to display multiple events, including the start date, event title, project title, and stage:

vbnetCopy code{% for e in events %} {{ e.event.start | date: "%B %-d, %Y" }} {{ e.event.title }} {{ e.project.title }} {{ e.event.stage }} {% endfor %}

This code will display each event's start date, title, project title, and stage for all events linked to the contract or invoice.

5. Displaying Deal Items with a For Loop

The same method can be used for displaying deal items associated with an event. Here’s an example:

rustCopy code{% for items in event.deal %} {{ items.type }} {{ items.tickets }} {{ items.tickets_type }} {{ items.amount | format_money }} {% endfor %}

This code will loop through all the deal items for an event and display the type, number of tickets, ticket type, and amount for each deal.

Note: The entered data, such as added in Deal-tab, will only display correctly on contracts and invoice PDFs if the templates are set up properly. Always double-check your PDFs before sending them out to ensure everything appears as expected.

Did this answer your question?