If you're trying to create a custom report, use this reference material.
When writing liquid templates, use tags and objects.
Output markup is enclosed in pairs of curly brackets:
{{ Output markup goes here }}
Tag markup is enclosed in curly brackets and percent signs:
{% Tag markup goes here %}
Output objects allow you to access data stored in the database and display dynamic content. Output markup can produce text that will be displayed in the report. Below, we have listed all the variables that PCO has made available for you to use in your Resources reports.
Tag markup allow you to write programming logic that tells the template what to do. Unlike output markup, it cannot produce text. There are a number of tags that can be used but the most common ones in reports are if and for.
If/else statements tells the report to only do something if a certain condition is met. For example:
{% if person.name == “Jake” %}
Hi Jake.
{% else %}
Your name is not Jake!
{% endif %}
For more information about if/else statements, see the Liquid documentation here.
In many cases you’ll want to iterate through a collection of objects such as events, rooms, resources, or days. With liquid, the best way to do this is with a for loop. The syntax is {% for item in collection %}. For example, to loop through the resources and display the name, you’d do:
{% for resource in resources %}
{{ resource.name }}
{% endfor %}
For more information about for loops, see the Liquid documentation here. Liquid has a number of filters which allow you to modify text, numbers or dates. You can read more about the Liquid filters here.
Collections
Generally, when writing a report, you’ll start with one of these collections and loop through the elements of the collection to display more information information about the events, rooms, or resources.
-
{{ days }} - A collection of the days within your report’s date range.
-
{{ days_with_instances }} - A collection of the days within your report's date range that have one or more event instance on that day.
-
{{ events }} - A collection of events within your report.
-
{{ resources }} - A collection of the resources within your report.
-
{{ rooms }} - A collection of the rooms within your report.
Report Variables
These variables will give you information that describes the report itself.
-
{{ report.title }} - The title of your report (its name in the report list).
-
{{ report.start_date }} - The start date of your report (Format: MM/DD/YYYY).
-
{{ report.end_date }} - The end date of your report (Format: MM/DD/YYYY).
-
{{ report.scope }} - The name of the object or location from where the report was created.
-
{{ report.organization_name }} - The name of your organization in Planning Center.
-
{{ report.organization_logo_url }} - Returns the URL for your organization's logo. You will need to add this in side of an <img> tag for the logo to show up, like this: <img src="{{ report.organization_logo_url }}" width="100">
-
{{ report.stylesheet_href }} - The url of the reports CSS stylesheet.
Report Days
Report days are the individual elements in the {{ days }} collection.
-
{{ day.date }} - The date of the report day (Format: YYYY-MM-DD). You can use a date filter to format this to your needs, i.e. {{day.date | date: '%A, %B %-d, %Y'}}
-
{{ day.instances }} - A collection of the event instances occurring that day. This is useful when creating a report by date. You can loop through the {{ days }} variable with {{ for day in days }}. Then you can loop through the events on a given day with {{ for instance in day.instances }}.
Events
Every event has its own properties as well as instances, reservations, and event times. Event instances represent the individual times that an event occurs whereas reservations correspond to reservation blocks. The event times collection contains the time blocks from the event schedule.
-
{{ event.name }} - The name of the event.
-
{{ event.event_folder_id }} - The ID number of the folder that the event is inside.
-
{{ event.tags }} - A collection of tags associated with the event
-
{{ event.instances }} - A collection of the event instances.
-
{{ event.approval_status }} - The approval status of the event.
-
{{ event.details }} - The description of the event (maximum of 255 characters).
-
{{ event.notes }} - The notes from the event.
-
{{ event.owner.name }} - The name of the person who owns the event.
-
{{ event.owner.email }} - The email address of the event owner.
-
{{ event_managers.name }} - The name of the person who is listed as the event manager.
-
{{ event.next_instance }} - The first instance of the event to occur in the date range selected for the report.
-
{{ event.next_instance_starts_at }} - The Date and time of the first instance of the event to occur in the date range selected for the report.
-
{{ instance.to_s }} - A readable title for the event instance. Example: Thursday, October 16, 2014 from 8:00am to 5:30pm.
-
{{ instance.event }} - The event to which the event instance belongs.
-
{{ instance.approval_status }} The approval status of the event instance.
-
{{ instance.starts_at }} - The starting date and time of the event instance.
-
{{ instance.ends_at }} - The ending date and time of the event instance.
-
{{ instance.event_times }} - A collection of event times for the instance. These event times are the blocks that make up the event schedule.
-
{{ instance.reservation }} - The reservation block to which the event instance belongs.
-
{{ reservation.name }} - The name of the reservation block.
-
{{ reservation.next_instance }} - The first instance of the reservation block to occur in the date range selected for the report.
-
{{ reservation.location }} - The location for the reservation block.
-
{{ reservation.room_requests }} - A collection of the reservation block’s room requests.
-
{{ reservation.resource_requests }} - A collection of the reservation block’s resource requests.
-
{{ reservation.simple_room_requests }} - A collection of the reservation block’s simple room requests. A request is considered simple if there are no room setups, answered questions, or associated resource requests.
-
{{ reservation.complex_room_requests }} - A collection of the reservation block’s complex room requests. This collection does not include simple room requests.
-
{{ reservation.simple_resource_requests }} - A collection of the reservation block’s simple resource requests.
-
{{ reservation.complex_resource__requests }} - A collection of the reservation block’s complex resource requests. This collection does not include simple resource requests.
-
{{ event_time.name }} - The name of the time block on the event schedule.
-
{{ event_time.starts_at }} - The starting time of the event time.
-
{{ event_time.ends_at }} - The ending time of the event time.
-
{{ tag.name }} - The name of the tag.
-
{{ tag.tag_group_name }} - The name of the tag group that the tag belongs to.
-
{{ tag.color }} - The color assigned to the tag in hex format. This is useful for making the background of the tag the same color as it is in Resources.
Resources and Rooms
All of the methods that work on resources and resource requests will also work on rooms and room requests. Once a resource or room request has been made, a booking exists which connects the resource to an event instance.
-
{{ room.name }} - The name of the room.
-
{{ resource.name }} - The name of the resource.
-
{{ room.bookings }} - A collection of the resource bookings for the given room.
-
{{ resource.bookings }} - A collection of the resource bookings for the given resource.
-
{{ room.resource_folder_id }} - The ID for the folder that the room is in. This will not return anything for rooms not in a folder.
-
{{ room.folder_name }} - The name of the folder that the room is in, if any.
-
{{ resource.resource_folder_id }} - The ID for the folder that the resource is in. This will not return anything for resources not in a folder.
-
{{ resource.folder_name }} - The name of the folder that the resource is in, if any.
-
{{ booking.request }} - Links to the room_request or resource_request related to that booking.
-
{{ booking.quantity }} - The quantity requested by the booking
-
{{ booking.approval_status }} - The approval status of the room or resource booking
-
{{ booking.starts_at }} - The starting date and time of the booking.
-
{{ booking.ends_at }} - The ending date and time of the booking.
-
{{ booking.reservation.name }} - The name of the reservation block label for which the room or resource has been booked.
-
{{ booking.event }} - The event with which the room or resource booking is associated. This is useful for displaying information about the related event. For example, to display the name of the event with which the booking is associated, you can use {{ booking.event.name }}
Resource Requests
To connect a room or resource with an event, a room or resource request must be made. These variables allow you to add information about these requests into your report.
-
{{ resource_request.resource }} - The resource requested by the event resource request.
-
{{ resource_request.quantity }} - The number of resources requested by the event resource request.
-
{{ resource_request.approval_status }} - The approval status for the request.
-
{{ resource_request.simple? }} Returns true if there are no room setups, no answers, and no resource requests associated with the event resource request.
-
{{ resource_request.resource_requests }} - A collection of dependent event resource requests.
-
{{ resource_request.simple_resource_requests }} - A collection of the simple dependent resource requests.
-
{{ resource_request.complex_resource_requests }} - A collection of the complex dependent resource requests.
-
{{ resource_request.answers }} A collection of the answers associated with the resources requested by the event resource request.
-
{{ room_request.room }} - The room requested by the event resource request.
-
{{ room_request.approval_status }} - The approval status for the request.
-
{{ event_resource_request.room_setup }} - The room setup for the request.
-
{{ event_resource_request.room_setup_information }} - Special information about the room setup specific to the resource request.
-
{{ room_request.answers }} - A collection of the answers associated with the resources requested by the event resource request.
Request Answers
When a room our resource has questions attached to it, these questions and answers are stored as request answers. In resource reports, to display questions and answers, you loop through the request answers {{ for qa in request_answers }} and display both the question {{ qa.question }} and answer {{ qa.answer }}.
-
{{ request_answer.question }} - The question to which the answer belongs.
-
{{ request_answer.answer }} - The answer to the question.
-
{{ request_answer.section_header? }} - Returns true if the question is in fact a section header.
-
{{ request_answer.label }} - The text for the section header if section_header? is true. This allows for readable report headers.
Room Setups
-
{{ room_setup.name }} - The name of the room setup.
-
{{ room_setup.description }} - The description of the room setup.
People
-
{{ person.name }} - The name of the person.
-
{{ current_user.name }} The name of the current user
-
{{ current_user.owned_events }} The events that the current user is the owner
We have a number of styles built to help your reports be aesthetically appealing. Feel free to experiment on your custom reports to see what works.
You can style elements using the following classes. For example, if you wanted a large header with a grey background and a gutter, you could use:
<div class=”block header-large gutter-bottom-medium”>This is a header!</div>
You can also add your own inline CSS styles for further customization.
If you would like to learn more about working with CSS, check out the second half of Codecademey’s Web Fundamentals course.
Below is a list of classes included in the stylesheet which can be linked to with {{ report.stylesheet_href }}. Our default reports link to this stylesheet so the reference will already be in the <head> when you start a new report.
.bg-soft - Sets the sets the background to a light grey color and pads the text. This is commonly used for section headers.
.block - Adds a grey left border and increases the left margin. This is useful for visually grouping related elements.
.container-naked - Adds a light grey border around the element.
.container-soft - Sets the background color to light grey.
.container-hard - Sets the background color to dark grey
.date-header - Sets the background to grey. Makes the font bold and slightly larger.
.divider - Creates a solid grey bar. Useful to create a visual break between elements.
.divider-soft - Creates a dotted light grey bar.
.gutter-top-small - Adds a small margin to the top of the element.
.gutter-top-medium - Adds a medium margin to the top of the element.
.gutter-bottom-small - Adds a small margin to the bottom of the element.
.gutter-bottom-medium - Adds a medium margin to the bottom of the element.
.header-small, .header-medium, .header-large, .header-jumbo - Creates headers of different sizes. Makes the text bold.
.header-caps - Makes all letters capital.
.item-title, .item-sub-title - Capitalizes the first letter of every word.
.item--inline, .sub-item--inline - Displays the item or sub-item as an inline block.
.level-2, .level-3, .level-4 - Adds padding to the left of the element. This is useful for visually grouping elements. For example:
<div class="level-1">
This is at the top level.
<div class="level-2">
This will have some padding on the left.
<div class="level-3">
This will have more padding on the left than the level-2 element.
</div>
</div>
</div>
.pad-left - Adds padding to the left.
.pad-left-small - Adds a smaller amount of padding to the left.
.pad-right - Adds padding to the right.
.pad-right-small - Adds a smaller amount of padding to the right.
.status - Creates a rounded box around the element.
.status .Approved - The box is green.
.status .Pending - The box is orange.
.status .Rejected - The box is red.
This class is commonly used with an approval status object. For example:
<span class=”status {{ obj.approval_status }}”>{{ obj.approval_status }}</span>
.txt-strong - Makes text bold.
.txt-center - Centers text.
.txt-left - Left-aligns text.
.txt-underline - Underlines text.
.soft - Colors text light grey.
.blue - Colors text blue.
.green - Colors text green.
.warning - Colors text orange.
.red - Colors the text red.