Koha How-To

Monday Minutes : Editing a SQL report

Editing an Existing Report

Whether a report has been found in the Koha Report Wiki or already exists in your report library- sometimes it would be helpful if the report could be edited to allow the user to choose which value is used vs just having one value.

In the tutorial video, Jessie and Kelly chose a report that was written specifically looking at one Shelving Location. The WHERE statement of this report looked like this:

WHERE i.location="AUDIO"

AUDIO is the Authorized Value code found in the Category "loc". But what if the library would like to use this report to look at different shelving locations and not just specifically AUDIO?

The WHERE statement could be altered to allow for the user to choose which location at the time of running the report. If so, then the WHERE statement of the report would look like this:

WHERE i.location=<<Shelving Location|loc>>

Below is an example of the report we showed during the video:

Other Examples

This same principle could be used for Item Types, Collection Codes, Not for Loan statuses and even branches. If there are other values to pull from, then this statement can be altered in your SQL report to allow the user to change.

For Branch:

WHERE branchcode=<<Branch|branches>>

For Item Type:

WHERE itype=<<Item Type|itemtypes>>

For Collection Codes:

WHERE ccode=<<Collection|ccode>>

Not for Loan Statuses:

WHERE notforloan=<<Not for Loan|not_loan>>

More Report Resources

If you are new to using the Reports Module, here are some great ByWater Tutorials to visit:

Writing Reports is as easy as ordering a cup of coffee!

Creating a Report for your Library using the Koha Report Wiki

The Reports portion of the Koha Manual is also very helpful.

Want More Monday Minute Tutorials?

Monday Minutes: Adding a Twitter feed to the OPAC

Monday Minutes: Submitting a Bug in Bugzilla

Using Lists to Populate your Coverflow on the OPAC