Creating Report Templates

Introduction

Once you have created a folder, the next step in building a report is to create or clone a template. Templates allow you to run a report more than once without building it anew every time, by changing definitions to suit current requirements. For example, you can create a shared template that reports on circulation at a given library. Then, other libraries can use your template and simply select their own library when they run the report.

It may take several tries to refine a report template to give the output that you want. It can be useful to plan out your report on paper before getting started with the reporting tool. Group together related fields and try to identify the key fields that will help you select the correct source.

It may be useful to create complex queries in several steps. For example, first add all fields from the table at the highest source level. Run a report and check to see that you get results that seem reasonable. Then clone the template, add any filters on fields at that level and run another report. Then drill down to the next table and add any required fields. Run another report. Add any filters at that level. Run another report. Continue until you’ve drilled down to all the fields you need and added all the filters. This might seem time consuming, and you will end up cloning your initial template several times. However, it will help you to check the correctness of your results and will help to debug if you run into problems because you will know exactly what changes caused the problem. Also consider adding extra fields in the intermediate steps to help you check your results for correctness.

Creating a Template

Before creating a completely new template, it is recommended that you check for shared templates to see if there is a template that can be modified to give you the information you need. The template search can be used to find and identify potential templates. Please note that the search does not provide the folder name where the template is stored. Be sure to leave out any special characters or punctuation in your search.

See Cloning Report Templates for more information.

Creating a template can be complex and requires some understanding of the Evergreen database and how Evergreen handles various records when performing tasks in the staff interface. It can be useful to plan out your template before getting started with the reporter. Think about what type of records you will be reporting on (circulation, item, bibliographic, patron, etc.) and what information you want to see displayed in your report output. You also want to think about what filters should be used so the report output contains only the records you’re interested in.

  1. Navigate to Administration → Reports.

  2. In the My Folders section, select the caret beside the Templates folder to see your template folders. Use the carets to expand the folder tree until you find the folder where you’d like to create the new template.

    Screenshot of the expanded templates folder tree under the My Folders section.
  3. Select the folder name.

  4. In the folder, select New Template.

    Screenshot of the five folder action buttons under the folder name. New Template is the second button.
  5. The New Template editor will open. See Report Template Editor for information on using the editor.

    Screenshot of the New Template page. The page header says New Template. Next are the Fields for Template Name, Documentation URL, and Folder, followed by the Template Description field. Below that are the save and close buttons. Under a dividing line is the Select Source drop-down and a lot of empty space.
  6. Add a Template Name.

  7. Choose a source using the Select Source drop-down menu. See Report Source for more details.

  8. Add Display Fields. See Adding a Display Field for more details.

  9. Add Filters. See Adding a Filter for more details.

    All report templates MUST have at least one filter to choose a specific library. This filter is important as it allows staff to restrict the data in the report output to only data relevant to their library.

  10. Add hardcoded filter values for any filters that should always use the same value. See Reporter Basics for a list of filters that are commonly hardcoded.

  11. Make adjustments to the Report Layout. See Template Report Layout for more details.

  12. Select Save.

  13. Your new template can now be found in the folder you saved it to.

  14. Run a report from the new template to see if the desired output is generated.

    If the path for one of your display fields or filters is incorrect, you will get an error instead of the expected report output. Sometimes the error text will give you a clue about what isn’t working.

    Screenshot from the Outputs folder. A line is selected. In the Output column, where you would normally see HTML and CSV button links, it says Error running report. The cursor is hovering over the Error text column to show the full error text. The text begins 'DBD::Pg::st execute failed: ERROR'.

    You can modify your template and try again.

  15. Repeat the above steps until your template works as desired.

It is not unusual to create multiple versions of a template when working to modify a template. Once you have a template that works as desired, it is recommended that you delete the interim versions of the template. See Deleting Report Templates.

Report Template Editor

The report template editor is made up of three sections:

  • Section A: Basic information

  • Section B: Display field and filter options and selections.

    • B1: Source.

    • B2: Available fields from selected Source.

    • B3 Fields selected for inclusion in template and modifying information.

  • Section C: Display Fields, Filters, and Report Layout tabs

Annotated screenshot of the New Template Editor screen. Across the top in section A: Template Name, Documentation URL, Folder, Templated Description. Under that, in the left pane, is section B1 which has the Source drop-down. Non-cataloged circulation is the source and below that is a tree showing the connected tables such as Circulating Library. In the main pane we have section C with the three tabs, currently displaying Display Fields. Below is B2, centrally placed on the screen, it is a list of all fields from the Non-cataloged Circulation source. To the right of B2 is B3 which shows a selected field, with relevant transform and an option to provide a hint. The label at the top of this section is Field Display Order.

Basic Information Section

The basic information section of the report template editor is where you can add or update the Template Name, Template Description, and Documentation URL.

The names of templates in a folder must be unique. Evergreen will not allow a template using an identical name to be saved into the same folder.

If you have local documentation online that pertains to a report template, you can add it in the Documentation URL field, and it will be included as a link in the report output.

Best practice for your Template Description is to include a brief summary of the report purpose, a list of display fields, and a list of filters.

As you make new iterations of the template you can keep track of your changes in the description field.

Display Field and Filter Selector

The Display Field and Filters selection area is where you build and modify the template columns, data filters, and report layout.

Report Source

Every report template starts with a Source. This is the database table from which your template is built. The drop-down menu displays as Select Source when a new template is first created. Selecting a Source will cause the rest of the display field and filter selections area to populate.

Screenshot of a new, unfilled, template. The drop-down menu option, Select Source, is highlighted below the basic information area and the Save and Close buttons.

When modifying an existing template, NEVER change the source. This will scrap your existing template and you will have to start again from scratch.

When creating a new template, the first thing you need to do is figure out which source makes the most sense for the data you want to see in your report output. If you need information from other tables, you’ll follow the table tree to those tables when adding display fields and filters. Sources are divided in the drop-down menu into Core sources and Other sources. Most standard statistics reports will be created with Core Sources as these represent the primary database tables. The Other sources are less frequently used tables or specially created data views.

The three most commonly used Core sources are Circulation, Item, and ILS User. Templates for monthly circulation statistics and templates for tracking overdue items use the Circulation source. Templates about the state of your collection use the Item source. Templates containing counts or lists of your patrons use the ILS User source. More information can be found in Commonly Used Tables.

You can link to other database tables to include information contained in those tables but not every table links directly. For example, patrons and items aren’t directly linked to each other. Information about items checked out to a patron is held in the circulation table while information about items on hold is found in the hold request table. More information can be found in documentation about the Evergreen Database.

Nullability

You may wish to use nullability if your report output includes null values that you don’t want included. A NULL value in a field means that there is no value in that field.

Nullability in Action

By default, Evergreen will include data that matches your query, even if there is a null value for one of your fields. If you do not want the null values to display in your results, use the nullability checkbox that can be found on the left of each potentially linked source.

Screenshot of the Source and Source tree area. The Source is Shelving Location with subsections for Copies, Copy Location Orders, and Owning Org Unit. The checkbox to the left of Copies is selected.

Selecting the nullability checkbox tells the template NOT to include data from that joined source if the field on the child, or right-side source, is null.

The simplified set of outputs below show the same results of a count of items by shelving location, with and without using the nullability checkbox. The first chart includes a line for DVDs, even though no items have been assigned to that shelving location. This would be the default provided by Evergreen. To get the result in the second chart, we would select the nullability box next to the Copies table as we built the report; just like you see in the image above.

Two charts side-by-side. They are identical except for the titles at the top and an additional row of data at the bottom of the left one. The left chart is titled Evergreen’s Default Results. The left column is labeled Shelving Location (parent table) and the right is labeled Item Count (child table). Fiction has 200 items. Non-fiction has 100 items. Reference has 50 items. DVD has NULL. The DVD line is highlighted. The right chart is labeled Results Using Nullability Checkbox. It does not show the DVD line, everything else is the same.

The default behavior can be a great way of catching possible data issues.

Details on Nullability in Evergreen

Nullability allows you to have more control over whether null values in fields are included in your report output. Once you have selected a source, you will see a tree on the far left showing the sources which can be linked (joined) to the selected source. The type of join determines what data can show up with a null value in your results: inner joins will only show non-null results; outer joins will allow null results.

The default behavior in Evergreen is now a left outer join; the parent can have a null value in the linking field to the child, in which case the parent will contribute a row but all the child fields for that row will be null. If there is a value in the parent’s linking field, then rows from the child (but only where the linking field matches!) will come in.

However, if we use the new nullability checkboxes we can create an inner join which will tell Evergreen to not include results where either parent or child are null.

To learn more about nullability, see the Evergreen conference presentation Thanks for Nothing: Nullability Selection in Evergreen Reports. While the Advanced Reports interface has changed since this presentation, the conceptual discussions of nullability are still applicable.

Display Fields

Display fields are the columns of information that will display on your report output. The Display Fields tab is the active tab by default in the Report Template Editor.

Adding a Display Field

Display fields are the columns which will be displayed in your report output.

  1. Ensure the Display Fields tab is the active tab in the Display Field, Filters, and Report Layout tabs section of the Report Template Editor.

  2. Select the top of the tree in the Source pane. A list of available fields will be displayed in the All Fields pane to the right under the Display Fields tab.

    Screenshot of the Source and All Fields sections. The blue link for item at the top of the source tree is highlighted and an arrow has been added pointing to the right towards the All Fields column header.
  3. The word in parentheses beside the field name indicates the data type. If the field you want to use is a link, you need to expand the tree in the Source pane to find it and then select it. This will open a new list of options under the All Fields heading. In the screenshot below, we have selected Call Number/Volume in the tree as this was displaying as a link when we were at the Item level. The current selection can be confirmed at the top next to the Source drop-down. Now that we are at the call number level, we can see that there are three different options related to call number. To display call numbers in an understandable way we will need to use Call Number Label.

    Screenshot of the left side of the screen with three highlighted areas, Call Number/Volume under the Source tree, the big confirmation text of which source we are viewing above the Display Fields tab, and the three call number related fields we could use under All Fields.
  4. Select the field in the All Fields pane you would like to add as a display field.

    For display fields, you generally want to pick a text field over an ID or org unit field. For example, to add call number as a display field, you will select Call Number Label rather than Call Number/Volume ID.

  5. In the Field Display Order pane, select the transform you would like to use. The transforms available in the list will vary depending on the data type of the selected field.

    1. The transform will determine how Evergreen processes the data when generating the report. Raw Data is the most commonly used transform for display fields except when it’s a timestamp, in which case Date is more commonly used. More information on the available transforms can be found in Field Transforms.

      A screenshot of one selected display field. The Name field says Call Number Label. The transform drop-down menu is open. Raw Data is the option selected at the top. The other options are Upper Case, First 5 characters, Lower Case, Substring, First Value, Last Value, Minimum Value, Maximum Value, and Count.

      The action Supply Hint on the Display Fields tab can generally be ignored. The column documentation will appear next to the column name in the Report Columns section of the template, but it does not appear next to the column name in the report output.

Reordering Display Fields

  1. You can use the arrows on the right to move fields up and down the list. The list order top to bottom here on the Display Fields tab will determine the order of column display from left to right. Sorting is controlled separately, in the Report Layout tab.

    A screenshot of two selected display fields. On the far right, next to the Transform field, there are a pair of arrow buttons. The left-side button points up and the right-side button points down. There is a pair of arrows for each display field.
  2. Repeat until your fields are in the order you desire.

Renaming a Display Field

You can adjust the display name of any field by clicking in the Name box and typing in a new name. The original field name will show below the Name box along with the path you took to field the field starting at your source.

It is best practice to include qualifiers in the field names for fields like barcode and library so that staff know what data they are looking at in the report output.

For example, for multi-branch libraries and libraries participating in reciprocal borrowing, it is not uncommon for the Circulating Library and Owning Library of an item to be different. In this case, it is important to specify in the field name which type of library is being presented in the report output data.

Changing a Transform

For information on specific transforms, see Field Transforms.

You can adjust the way data will display in your output by using the Transform dropdown on each selected field. Transform options will vary depending on the fields you have selected, and in some cases will default to a specific recommended transform value (e.g., fields that total payments will default to a transform of “Sum”).

Screenshot of two selected fields under the Field Display Order section. The transform field for Copy ID is open to show the following options: Raw Data, First Value, Last Value, Minimum Value, Maximum Value, and Count.

Removing a Display Field

Removing display fields usually does not affect the result set for the report output, but it can, especially when the report output displays a count of records (whether item, patron, circulation, hold, or bibliographic).

When removing fields, be mindful of whether or not it will still be clear in the report output what your results mean.

You can remove a field by clicking the minus button on the left of this area. You can also remove a field by unchecking it from the options under the All Fields header.

Screenshot of the Display Fields tab contents. On the left is the list of possible fields. One of the fields, Copy ID, is selected and there is a box highlighting the selected checkbox. The right side of the screen shows the information for the Copy ID field. There is a box highlighting the minus button next to the field name.

Filters

Adding a Filter

Filters allow you to set up the criteria so that Evergreen returns the information you are looking for. Once the criteria have been added to the template, the value for the filter can be hardcoded in at the template level or entered when the report is run.

  1. Select the Filters tab as the active tab in the Display Fields, Filters, and Report Layout tabs section of the Report Template Editor.

  2. As you did when selecting the display fields, select the top of the tree in the Source pane. A list of available fields will be displayed under All Fields.

    Screenshot shows All fields related to Circulation under the All Fields header. The checkbox for Checkin Scan Date/Time is selected and that field is displayed on the right.
    1. The word in parentheses beside the field name indicates the data type. If the field you want to use is a link, you need to expand the tree in the Source pane to find it and then select it. This will open a new list of options under the All Fields heading.

  3. Select the field in the All Fields pane you would like to add as a display field.

    For filters you generally want to pick an ID, or Org unit field over a text field. For example, to add circulating library as a filter you will select Circulating Library which is labeled as an Org unit.

  4. In the Filter Fields and Values area, select the transform you would like to use. The transforms available in the list will vary depending on the data type of the selected field.

    1. The transform will determine how Evergreen processes the data when generating the report. Raw data is the most commonly used transform for filters except when it’s a timestamp in which case Date or Month + Year is more commonly used. More information on the available transforms can be found in Field Transforms.

  5. Next, select the Operator. See Report Operators.

    Screenshot of a selected filter, Checkin Scan Date/Time. Highlighted below the field name are the Transform and Operator drop-down menus. The selected transform is Date, and the selected operator is Between.
  6. If desired, you can hardcode the value of the filter into the template. See Hardcoded Filters for more information.

Changing a Transform

For information on specific transforms, see Field Transforms.

  1. On the Filters tab, locate the field for which you would like to change the transform.

  2. Use the Transform drop-down on the field to select the transform you would like to use. The transforms available in the list will vary depending on the data type of the selected field.

Screenshot of the same selected filter as above. The left drop-down for Transform is highlighted. The selected transform is Date.

Changing an Operator

For information on specific operators, see Report Operators.

  1. On the Filter tab, locate the field on which you would like to change the operator.

  2. Use the Operator drop-down on the field to select the new operator from the list.

Screenshot of the same selected filter as above. The right drop-down for Operator is highlighted. The selected operator is Between.

Updating a Filter Value

Filter values can be hardcoded into a template or left blank to be filled in when the report is run. Information on commonly hardcoded filters can be found in Reporter Basics.

Hardcoding a filter is recommended when the value of the filter will not change. For example, hardcoded filters are often used when filtering out deleted items.

Filter values can also be hardcoded into templates to make it easier for staff with less reporter experience to run certain reports. For example, you can set up a report with an Item Status filter with a hardcoded value of Missing so that staff can run a report to get a list of all missing items without having to enter filter information.

It is recommended that you balance the reusability of templates that comes when staff enter filter values at the time of running a report versus the ease of use for staff with less experience with the reporter. For example, when no value is entered in the template for a filter on Item Status, staff can pick the relevant status from the list of existing statuses. When a value is hardcoded for Item Status, a new template must be created every time you wish to filter on a different item status.

  1. On the Filter tab, locate the field you would like to add, update, or remove the filter value for.

    1. To add a value,

      1. Select the Supply Filter Value checkbox beneath the field’s Transform field. A new set of options for Filter value will be displayed under the Operator field. The particular filter mechanism will vary depending on your selected Transform and Operator. See Filter Values for details on exactly how different values must be entered.

      2. Select or enter your desired value.

    2. To edit a preexisting value, overwrite the current Filter Vale with your desired value.

    3. To remove an existing hardcoded value, deselect the Supply Filter Value checkbox. Filter values will instead need to be added at the report definition level.

Screenshot of the selected filter field 'Is Deleted'. Below the transform field the Supply Filter Value box is checked. To the right, under the operator field, the filter value is set to False.

Removing a Filter

Removing a filter WILL affect what results are included in your report output. Ensure you don’t need to filter on a particular field before removing it.

It is recommended that reports have at least one filter to choose a specific library. This filter is important as it allows staff to restrict the data in the report output to only data relevant to their library.

You can remove a field by clicking the minus button on the left of this area. You can also remove a field by unchecking it from the options under the All Fields header.

Screenshot of the Filters tab contents. On the left is the list of possible fields. One of the fields, Is Deleted, is selected and there is a box highlighting the selected checkbox. The right of the screen shows the information for the Is Deleted field. There is a box highlighting the minus button next to the field name.

Changing the Column Documentation

When running a report, the filter can include text which gives information on how to use the particular filter and, in some cases, how to enter the filter value. In the Report Template Editor, this is referred to as column documentation or a field hint.

  1. On the Filter tab, locate the field you would like to add column documentation to.

  2. Select the Supply Hint box.

  3. Enter the hint text in the newly displayed field.

    Screenshot of a filter for creation date/time. Under the transform and operator fields are checkboxes for supply filter value and supply hint. Supply hint is checked and the newly exposed hint text field is filled in and highlighted.
  4. When running a report, the hint will display under the filter path.

    Screenshot of the same filter but from the report view instead of the template view. The hint is now displayed in the lower right of the filter area.

Template Report Layout

Select the Report Layout tab to adjust the organization of the data on your final output. On the left side, under Field Display Order, you can rename columns, adjust transforms, and reorder your columns in this tab in the same way you can in the Field Display tab.

On the right side, under Field Sort Order, you can independently set sort orders on each column as well as determine which column should sort first, second, third, etc. The sorting is independent of the column display order.

Screenshot of two columns under the report layout tab. They show different information related to the same list of selected display fields. The left column, Field Display Order, looks the same as the view on the display fields tab. The right side has the field display names greyed out to indicate the names cannot be edited here. To the right of the name field is a direction field that indicates Descending or Ascending behavior. Further to the right is a pair of arrows like on the Display Fields tab. The order of the field in the left column is Organizational Unit, Circulations, Workstation Name. The order on the right column is Circulations, Organizational Unit, and Workstation Name.

In the example above, the first three columns to display will be Organizational Unit, Circulations, and then Workstation Name, but the report will sort first by Circulations, then by Organizational Unit, and then by Workstation Name.

Troubleshooting Report Templates

If the path for one of your display fields or filters is incorrect, when you try to run a report you will get an error instead of the expected report output. Sometimes the error text will give you a clue about what isn’t working. You can modify your template and try again.

image::reporter_create_templates/output_error["Screenshot from the Outputs folder. A line is selected. In the Output column, where you would normally see HTML and CSV button links, it says Error running report. The cursor is hovering over the Error text column to show the full error text. The text begins 'DBD::Pg::st execute failed: ERROR'."]

If you continue to run into difficulties creating or modifying a template, you may need to contact your system administrator for assistance.

Before contacting your system administrator, ensure the applicable template folder is shared with your library so your system administrator is able to view the template in question.

When contacting your system administrator, include the following information:

  • Username of the staff account where the template has been created.

  • Folder where the template has been created.

  • Name of the template in question.

  • Desired end result for the template (what do you want it to report on?).

  • Specific display fields or filters you are having difficulties modifying or adding.

  • Links to your current report output from the template if relevant.