Table of Contents
Reports in Koha are a way to gather data. Reports are used to generate statistics, member lists, shelving lists, or any list of data in your database.
Get there: More > Reports
The guided report wizard will walk you through a six step process to generate a report.
Step 1: Choose the module you want to report on. This will determine what tables and fields are available for you to query.
Step 2: Choose a report type. For now, Tabular is the only option available.
Step 3: Choose the fields you want in your report. You can select multiple fields and add them all at once by using CTRL+Click on each item you want to add before clicking the Add button.
Step 4: Choose any limits you might want to apply to your report (such as item types or branches). If you don't want to apply any limits, simply click Next instead of making an option.
Step 5: Perform math functions. If you don't want to do any calculations, simply click Next instead of making an option.
Step 6: Choose data order. If you want the data to print out in the order it's found in the database, simply click Finish.
When you are finished you will be presented with the SQL generated by the report wizard. From here you can choose to save the report by clicking 'Save' or copy the SQL and make edits to it by hand.
If you choose to save the report you will be asked to name your report and enter any notes regarding it.
Once your report is saved it will appear on the 'Use Saved' page with all other saved reports.
From here you can make edits, run the report, or schedule a time to have the report run. To find the report you created you can sort by any of the columns by clicking the on the column header (creation date is the best bet for finding the report you just added). You can also filter your results using the filter menu on the left.
In addition to the report wizard, you have the option to write your own queries using SQL. To find reports written by other Koha users, visit the Koha Wiki: http://wiki.koha-community.org/wiki/SQL_Reports_Library. You can also find your database structure in /installer/data/mysql/kohastructure.sql or online at: http://schema.koha-community.org.
To add your query, click the link to 'Create from SQL' on the main reports module or the New button at the top of the Saved Reports page.
Fill in the form presented
The name is what will appear on the Saved Reports page to help you identify the report later. It will also be searchable using the filters found the left of the Saved Reports page.
Notes will also appear on the Saved Reports page, this can be used to provide more details about the report or tips on how to enter values when it runs
The type should always be 'Tabular' at this time since the other formats have not been implemented
In the SQL box you will type or paste the SQL for the report
If you feel that your report might be too resource intensive you might want to consider using runtime parameters to your query. Runtime parameters basically make a filter appear before the report is run to save your system resources.
There is a specific syntax that Koha will understand as 'ask for values when running the report'. The syntax is <<Question to ask|authorized_value>>.
The << and >> are just delimiters. You must put << at the beginning and >> at the end of your parameter
The 'Question to ask' will be displayed on the left of the string to enter.
The authorized_value can be omitted if not applicable. If it contains an authorized value category, or branches or itemtype or categorycode, a list with the Koha authorized values will be displayed instead of a free field Note that you can have more than one parameter in a given SQL Note that entering nothing at run time won't probably work as you expect. It will be considered as "value empty" not as "ignore this parameter". For example entering nothing for : "title=<<Enter title>>" will display results with title='' (no title). If you want to have to have something not mandatory, use "title like <<Enter title>>" and enter a % at run time instead of nothing
SELECT surname,firstname FROM borrowers WHERE branchcode=<<Enter patrons library|branches>> AND surname like <<Enter filter for patron surname (% if none)>>
SELECT * FROM items WHERE homebranch = <<Pick your branch|branches>> and barcode like <<Partial barcode value here>>
To generate a date picker calendar to the right of the field when running a report you can use the 'date' keyword like this: <<Enter Date|date>>
You have to put "%" in a text box to 'leave it blank'. Otherwise, it literally looks for "" (empty string) as the value for the field.
In addition to using any authorized value code to generate a dropdown, you can use the following values as well: Branches (branches), Item Types (itemtypes) and Patron Categories (categorycode). For example a branch pull down would be generated like this <<Branch|branches>>
There is a limit of 10,000 records put on SQL statements entered in Koha. To get around this you want to add 'LIMIT 100000' to the end of your SQL statement (or any other number above 10,000.
Once everything is entered click the 'Save Report' button and you'll be presented with options to run it. Once a report is saved you do not have to recreate it you can simply find it on the Saved Reports page and run or edit it.
Every report can be edited from the reports lists. To see the list of reports already stored in Koha, click 'Use Saved.'
To find the report you'd like to edit you can sort by any of the columns by clicking the on the column header. You can also filter your results using the filter menu on the left.
From this list you can edit any custom report by clicking 'Edit SQL'
Once custom reports are saved to Koha, you can run them by going to the Saved Reports page and clicking the Run link to the right of the report.
When you report runs you will either be asked for some values
or you will see the results right away
From the results you can choose to rerun the report by clicking 'Run report' at the top, edit the report by clicking the 'Edit' button or starting over and creating a new report by using the 'New' button. You can also download your results by choosing a file type at the bottom of the results next to the 'Download the report' label and clicking 'Download.'
A Comma Separated Text file is a CSV file and it can be opened by any spreadsheet application.