Koha How-To

Koha Question of the Week: What are Sort Fields on the Patron Record?

Each Friday, we will bring you a new Koha Question of the Week. We will select real questions that we receive and share the answers with you!

Question: What are Sort Fields on the Patron Record?

Answer: Think of the sort values on the patron record as a place to gather more data on your patron. Generally, Sort 1 and 2 are used for statistical purposes within your library. A library can use a Sort Field for collecting data such as County, Homeroom, and more.

A sort field can be attached to an authorized value, so if a library would like this to be populated with a dropdown menu of options including Yes/No, that can easily be done.

To add values to the Sort fields, head over to Administration.

From the Administration Module, choose Authorized Values.

Under the Authorized Values, there are Bsort1 and Bsort2.

Here you can add values and they will appear in the Sort Field when registering a patron. In this example, I created values for the Counties in the area.

And also made this value only used for the "Bookmobile" library. For other libraries registering a patron, this would not appear during their registration. The field will be there, but not the values that were created.


Once your library is collecting this extra data, a quick report can be used to find out the information on your patrons!

Here is a report that a library can enter the value of the Sort and run the report to see checkouts:

<b>SELECT</b> CONCAT('<a href=<b>\"</b>/cgi-bin/koha/members/moremember.pl?borrowernumber=',p.borrowernumber,'<b>\"</b>>',p.surname, ', ', p.firstname,'</a>') <b>AS</b> patron, p.cardnumber, 
 <b>REPLACE</b>((<b>SELECT</b> count(c.itemnumber) <b>FROM</b> issues c <b>WHERE</b> p.borrowernumber=c.borrowernumber <b>AND</b> c.date_due >= now()),'0','') <b>AS</b> checkouts, 
 <b>REPLACE</b>(CONCAT('<div style=<b>\"</b>color:#f11<b>\"</b>>',(<b>SELECT</b> count(i.itemnumber) <b>FROM</b> issues i <b>WHERE</b> p.borrowernumber=i.borrowernumber <b>AND</b> i.date_due < now()),'</div>'),'0','') <b>AS</b> overdues 
<b>FROM</b> borrowers p 
<b>WHERE</b> p.sort1=<<Sort 1 value>> 
<b>ORDER</b> <b>BY</b> p.surname, p.firstname

Additional Resources

Another place Koha allows for data to be collected and entered into Koha is through Patron Attributes, which allows a little bit more flexibility and customization when using this option.

For more information on Patron Attributes:

Monday Minutes: Patron Attributes