Update systempreferences.rst
[kohadocs.git] / source / reports.rst
1 .. include:: images.rst
2
3 Reports
4 =======
5
6 Reports in Koha are a way to gather data. Reports are used to generate
7 statistics, member lists, shelving lists, or any list of data in your
8 database.
9
10 -  *Get there:* More > Reports
11
12 .. _custom-reports-label:
13
14 Custom Reports
15 -----------------------------------
16
17 Koha's data is stored in a MySQL database which means that librarians
18 can generate nearly any report they would like by either using the
19 :ref:`Guided Reports Wizard <guided-report-wizard-label>` or writing their own
20 :ref:`SQL query <report-from-sql-label>`.
21
22 .. _add-custom-report-label:
23
24 Add Custom Report
25 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26
27 .. _guided-report-wizard-label:
28
29 Guided Report Wizard
30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31
32 The guided report wizard will walk you through a six step process to
33 generate a report.
34
35 Step 1: Choose the module you want to report on. This will determine
36 what tables and fields are available for you to query.
37
38 'Report is public' should be left to the default of 'No' in most cases 
39 especially if the report contains patron or other sensitive information.
40 A public report can be accessed using the :ref:`JSON reports services 
41 <json-reports-services-label>` by anyone and without authentication.
42
43 |image881|
44
45     **Note**
46
47     If your system administrator has set up memcache on your server you
48     might see one more option for the Cache expiry. This is related to
49     your public reports. If you make the report public then it's
50     constantly running and will cause a large load on your system.
51     Setting this value prevents that.
52
53     |image1292|
54
55 Step 2: Choose a report type. For now, Tabular is the only option
56 available.
57
58 |image882|
59
60 Step 3: Choose the fields you want in your report. You can select
61 multiple fields and add them all at once by using CTRL+Click on each
62 item you want to add before clicking the Add button.
63
64 |image883|
65
66 Step 4: Choose any limits you might want to apply to your report (such
67 as item types or branches). If you don't want to apply any limits,
68 simply click Next instead of making an option.
69
70 |image884|
71
72 Step 5: Perform math functions. If you don't want to do any
73 calculations, simply click Next instead of making an option.
74
75 |image885|
76
77 Step 6: Choose data order. If you want the data to print out in the
78 order it's found in the database, simply click Finish.
79
80 |image886|
81
82 When you are finished you will be presented with the SQL generated by
83 the report wizard. From here you can choose to save the report by
84 clicking 'Save' or copy the SQL and make edits to it by hand.
85
86 |image887|
87
88 If you choose to save the report you will be asked to name your report,
89 sort it in to groups and subgroups and enter any notes regarding it.
90
91 |image888|
92
93 Once your report is saved it will appear on the 'Use Saved' page with
94 all other saved reports.
95
96 |image889|
97
98 From here you can make edits, run the report, or schedule a time to have
99 the report run. To find the report you created you can sort by any of
100 the columns by clicking the on the column header (creation date is the
101 best bet for finding the report you just added). You can also filter
102 your results using the filter menu on the left or use the tabs to find
103 reports based on your custom groups.
104
105 .. _report-from-sql-label:
106
107 Report from SQL
108 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
109
110 In addition to the report wizard, you have the option to write your own
111 queries using SQL. To find reports written by other Koha users, visit
112 the Koha Wiki: http://wiki.koha-community.org/wiki/SQL_Reports_Library.
113 You can also find your database structure in
114 /installer/data/mysql/kohastructure.sql or online at:
115 `http://schema.koha-community.org <http://schema.koha-community.org/>`__.
116
117 To add your query, click the link to 'Create from SQL' on the main
118 reports module or the 'New report' button at the top of the 'Saved
119 reports' page.
120
121 |image890|
122
123 Fill in the form presented
124
125 |image891|
126
127 -  The 'Name' is what will appear on the Saved Reports page to help you
128    identify the report later. It will also be searchable using the
129    filters found the left of the Saved Reports page.
130
131 -  You can use the 'Report group' to organize your reports so that you
132    can easily filter reports by groups. Report groups are set in the
133    `REPORT\_GROUP <#reportgroup>`__ authorized value category or can be
134    added on the fly when creating the report by choosing the 'or create'
135    radio button.
136
137    |image1293|
138
139    Report groups set up in the authorised value category
140    need to have unique authorised values and descriptions.
141
142    -  **Note**
143
144           If you're adding a report group on the fly, remember that you
145           code should be fewer than 10 characters and should not include
146           special characters or spaces.
147
148 -  You can use 'Report subgroup' to further organize your reports so
149    that you can easily filter reports by groups and subgroups. Report
150    subgroups are set in the `REPORT\_SUBGROUP <#reportsubgroup>`__
151    authorized value category or can be added on the fly when creating
152    the report by choosing the 'or create' radio button.  Report Subgroups
153    are set up with unique values in Authorised Value, and Description. 
154    The Description (OPAC) field needs to contain the authorised value for 
155    the Report Group that the Subgroup falls under.
156
157    |image892|
158
159    -  **Note**
160
161           If you're adding a report subgroup on the fly, remember that
162           you code should be fewer than 10 characters and should not
163           include special characters or spaces.
164
165 -  'Report is public' should be left to the default of 'No' in most cases 
166     especially if the report contains patron or other sensitive information.
167     A public report can be accessed using the :ref:`JSON reports services 
168     <json-reports-services-label>` by anyone and without authentication.
169
170 -  'Notes' will also appear on the Saved Reports page, this can be used
171    to provide more details about the report or tips on how to enter
172    values when it runs
173
174 -  The type should always be 'Tabular' at this time since the other
175    formats have not been implemented
176
177 -  In the 'SQL' box you will type or paste the SQL for the report
178
179 -  If you feel that your report might be too resource intensive you
180    might want to consider using runtime parameters to your query.
181    Runtime parameters basically make a filter appear before the report
182    is run to save your system resources.
183
184    There is a specific syntax that Koha will understand as 'ask for
185    values when running the report'. The syntax is <<Question to
186    ask\|authorized\_value>>.
187
188    -  The << and >> are just delimiters. You must put << at the
189       beginning and >> at the end of your parameter
190
191    -  The 'Question to ask' will be displayed on the left of the string
192       to enter.
193
194    -  The authorized\_value can be omitted if not applicable. If it
195       contains an authorized value category, or branches or itemtype or
196       categorycode or biblio\_framework, a list with the Koha authorized
197       values will be displayed instead of a free field Note that you can
198       have more than one parameter in a given SQL Note that entering
199       nothing at run time won't probably work as you expect. It will be
200       considered as "value empty" not as "ignore this parameter". For
201       example entering nothing for : "title=<<Enter title>>" will
202       display results with title='' (no title). If you want to have to
203       have something not mandatory, use "title like <<Enter title>>" and
204       enter a % at run time instead of nothing
205
206    Examples:
207
208    -  SELECT surname,firstname FROM borrowers WHERE branchcode=<<Enter
209       patrons library\|branches>> AND surname like <<Enter filter for
210       patron surname (% if none)>>
211
212    -  SELECT \* FROM items WHERE homebranch = <<Pick your
213       branch\|branches>> and barcode like <<Partial barcode value here>>
214
215    -  SELECT title , author FROM biblio WHERE frameworkcode=<<Enter the
216       frameworkcode\|biblio\_framework>>
217
218        **Note**
219
220        To generate a date picker calendar to the right of the field when
221        running a report you can use the 'date' keyword like this:
222        <<Enter Date\|date>>
223
224        |image893|
225
226        **Note**
227
228        You have to put "%" in a text box to 'leave it blank'. Otherwise,
229        it literally looks for "" (empty string) as the value for the
230        field.
231
232        **Important**
233
234        In addition to using any authorized value code to generate a
235        dropdown, you can use the following values as well: Framework
236        codes (biblio\_framework), Branches (branches), Item Types
237        (itemtypes) and Patron Categories (categorycode). For example a
238        branch pull down would be generated like this
239        <<Branch\|branches>>
240
241        |image894|
242
243     **Note**
244
245     There is a limit of 10,000 records put on SQL statements entered in
246     Koha. To get around this you want to add 'LIMIT 100000' to the end
247     of your SQL statement (or any other number above 10,000).
248
249     **Note**
250
251     If your system administrator has set up memcache on your server you
252     might see one more option for the Cache expiry. This is related to
253     your public reports. If you make the report public then it's
254     constantly running and will cause a large load on your system.
255     Setting this value prevents that.
256
257     |image1294|
258
259 Once everything is entered click the 'Save Report' button and you'll be
260 presented with options to run it. Once a report is saved you do not have
261 to recreate it you can simply find it on the Saved Reports page and
262 :ref:`run <running-custom-reports-label>` or :ref:`edit <edit-custom-reports-label>` it.
263
264 .. _duplicate-report-label:
265
266 Duplicate Report
267 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
268
269 Reports can also be added by duplicating an existing report. Visit the
270 'Saved reports' page to see all of the reports listed on your system
271 already.
272
273 |image895|
274
275 To the right of every report there is an 'Actions' pull down. Clicking
276 that and choose 'Duplicate' to use an existing report as the basis for
277 your new report. That will populate the new report form with the
278 existing SQL for easy editing and resaving.
279
280 .. _edit-custom-reports-label:
281
282 Edit Custom Reports
283 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
284
285 Every report can be edited from the reports lists. To see the list of
286 reports already stored in Koha, click 'Use Saved.'
287
288 |image896|
289
290 To find the report you'd like to edit you can sort by any of the columns
291 by clicking the on the column header. You can also filter your results
292 using the filter menu on the left or use the tabs to find reports based
293 on your custom groups.
294
295 From this list you can edit any custom report by clicking 'Actions' to
296 the right of the report and choosing 'Edit' from the menu that appears.
297
298 |image897|
299
300 The form to edit the report will appear.
301
302 |image898|
303
304 .. _running-custom-reports-label:
305
306 Running Custom Reports
307 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308
309 Once custom reports are saved to Koha, you can run them by going to the
310 Saved Reports page and clicking the 'Actions' button to the right of the
311 report and choosing 'Run'.
312
313 |image899|
314
315 When you report runs you will either be asked for some values
316
317 |image900|
318
319 or you will see the results right away
320
321 |image901|
322
323 From the results you can choose to rerun the report by clicking 'Run
324 report' at the top, edit the report by clicking the 'Edit' button or
325 starting over and creating a new report by using the 'New' button. You
326 can also download your results by choosing a file type at the bottom of
327 the results next to the 'Download the report' label and clicking
328 'Download.'
329
330     **Note**
331
332     A Comma Separated Text file is a CSV file and it can be opened by
333     any spreadsheet application.
334
335 .. _send-itemnumbers-to-batch-item-modification-label:
336
337 Send itemnumbers to batch item modification
338 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339
340 After running a report that contains itemnumbers the list of numbers can be imported
341 directly into :ref:`Batch item modification` by clicking the batch modify button
342 in the report results.
343
344 |image1343|
345
346 .. _statistics-reports-label:
347
348 Statistics Reports
349 --------------------------------------
350
351 Statistic reports will show you counts and sums. These reports are all
352 about numbers and statistics, for reports that return more detailed
353 data, use the :ref:`Guided Report Wizard`. These
354 reports are limited in what data they can look at, so it's often
355 recommended to use :ref:`custom reports <custom-reports-label>` for official end
356 of the year statistics.
357
358 .. _acquisitions-statistics-label:
359
360 Acquisitions Statistics
361 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
362
363     **Note**
364
365     These reports are limited in what data they can look at, so it's
366     often recommended to use :ref:`custom reports <custom-reports-label>` for
367     official end of the year statistics.
368
369 Using the form provided, choose which value you would like to appear in
370 the Column and which will appear in the Row.
371
372 |image902|
373
374 If you choose to output to the browser your results will print to the
375 screen.
376
377 |image903|
378
379 You can also choose to export to a file that you can manipulate to your
380 needs.
381
382 When generating your report, note that you get to choose between
383 counting or summing the values.
384
385 |image904|
386
387 Choosing amount will change your results to appear as the sum of the
388 amounts spent.
389
390 |image905|
391
392 .. _patron-statistics-label:
393
394 Patron Statistics
395 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
396
397     **Note**
398
399     These reports are limited in what data they can look at, so it's
400     often recommended to use :ref:`custom reports <custom-reports-label>` for
401     official end of the year statistics.
402
403 Using the form provided, choose which value you would like to appear in
404 the Column and which will appear in the Row.
405
406 |image906|
407
408 If you choose to output to the browser your results will print to the
409 screen.
410
411 |image907|
412
413 Based on your selections, you may see some query information above your
414 results table. You can also choose to export to a file that you can
415 manipulate to your needs.
416
417 .. _catalog-statistics-label:
418
419 Catalog Statistics
420 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
421
422     **Note**
423
424     These reports are limited in what data they can look at, so it's
425     often recommended to use :ref:`custom reports <custom-reports-label>` for
426     official end of the year statistics.
427
428 Using the form provided, choose which value you would like to appear in
429 the Column and which will appear in the Row.
430
431 |image908|
432
433 If you choose to output to the browser your results will print to the
434 screen.
435
436 |image909|
437
438 You can also choose to export to a file that you can manipulate to your
439 needs.
440
441 .. _circulation-statistics-label:
442
443 Circulation Statistics
444 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
445
446     **Note**
447
448     These reports are limited in what data they can look at, so it's
449     often recommended to use :ref:`custom reports <custom-reports-label>` for
450     official end of the year statistics.
451
452 Using the form provided, choose which value you would like to appear in
453 the Column and which will appear in the Row.
454
455 |image910|
456
457 If you choose to output to the browser your results will print to the
458 screen.
459
460 |image911|
461
462 You can also choose to export to a file that you can manipulate to your
463 needs.
464
465     **Note**
466
467     To get a complete picture of your monthly or daily circulation, you
468     can run the report twice, once for 'Type' of 'Checkout' and again
469     for 'Renewal.'
470
471     This report uses 'Period,' or date, filtering that allows you to
472     limit to a month by simply selecting the first day of the first
473     month through the first day of the next month. For example, 10/1 to
474     11/1 to find statistics for the month of October.
475
476     -  To find daily statistics, set your date range.</br> Example: "I
477        want circulation data starting with date XXX up to, but not
478        including, date XXX."
479
480     -  For a whole month, an example range would be: 11/01/2009 to
481        12/01/2009
482
483     -  For a whole year, an example range would be: 01/01/2009 to
484        01/01/2010
485
486     -  For a single day, an example would be: 11/15/2009 to 11/16/2009
487        to find what circulated on the 15th
488
489 .. _tracking-in-house-use-label:
490
491 Tracking in house use
492 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
493
494 Using the Circulation statistics reporting wizard you can run reports on
495 in house usage of items simply by choosing 'Local Use' from the 'Type'
496 pull down:
497
498 |image912|
499
500 .. _serials-statistics-label:
501
502 Serials Statistics
503 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
504
505     **Note**
506
507     These reports are limited in what data they can look at, so it's
508     often recommended to use :ref:`custom reports <custom-reports-label>` for
509     official end of the year statistics.
510
511 Using the form provided, choose how you would like to list the serials
512 in your system.
513
514 |image913|
515
516 If you choose to output to the browser your results will print to the
517 screen.
518
519 |image914|
520
521 You can also choose to export to a file that you can manipulate to your
522 needs.
523
524 .. _holds-statistics-label:
525
526 Holds Statistics
527 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
528
529     **Note**
530
531     These reports are limited in what data they can look at, so it's
532     often recommended to use :ref:`custom reports <custom-reports-label>` for
533     official end of the year statistics.
534
535 Using the form provided you can see statistics for holds placed, filled,
536 cancelled and more at your library. From the form choose what value you
537 want to display in the column and what value to show in the row. You can
538 also choose from the filters on the far right of the form.
539
540 |image915|
541
542 If you choose to output to the browser your results will print to the
543 screen.
544
545 |image916|
546
547 You can also choose to export to a file that you can manipulate to your
548 needs.
549
550 .. _patrons-with-the-most-checkouts-label:
551
552 Patrons with the most checkouts
553 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
554
555 This report will simply list the patrons who have the most checkouts.
556
557 |image917|
558
559 If you choose to output to the browser your results will print to the
560 screen.
561
562 |image918|
563
564 You can also choose to export to a file that you can manipulate to your
565 needs.
566
567 .. _most-circulated-items-label:
568
569 Most Circulated Items
570 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
571
572 This report will simply list the items that have the been checked out
573 the most.
574
575 |image919|
576
577 If you choose to output to the browser your results will print to the
578 screen.
579
580 |image920|
581
582 You can also choose to export to a file that you can manipulate to your
583 needs.
584
585 .. _patrons-with-no-checkouts-label:
586
587 Patrons with no checkouts
588 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
589
590 This report will list for you the patrons in your system who haven't
591 checked any items out.
592
593 |image921|
594
595 If you choose to output to the browser your results will print to the
596 screen.
597
598 |image922|
599
600 You can also choose to export to a file that you can manipulate to your
601 needs.
602
603 .. _items-with-no-checkouts-label:
604
605 Items with no checkouts
606 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
607
608 This report will list items in your collection that have never been
609 checked out.
610
611 |image923|
612
613 If you choose to output to the browser your results will print to the
614 screen.
615
616 |image924|
617
618 You can also choose to export to a file that you can manipulate to your
619 needs.
620
621 .. _catalog-by-item-type-label:
622
623 Catalog by Item Type
624 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
625
626 This report will list the total number of items of each item type per
627 branch.
628
629 |image925|
630
631 If you choose to output to the browser your results will print to the
632 screen.
633
634 |image926|
635
636 You can also choose to export to a file that you can manipulate to your
637 needs.
638
639 .. _lost-items-label:
640
641 Lost Items
642 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
643
644 This report will allow you to generate a list of items that have been
645 marked as Lost within the system
646
647 |image927|
648
649 .. _average-loan-time-label:
650
651 Average Loan Time
652 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
653
654 This report will list the average time items are out on loan based on
655 the criteria you enter:
656
657 |image928|
658
659 If you choose to output to the browser your results will print to the
660 screen.
661
662 |image929|
663
664 You can also choose to export to a file that you can manipulate to your
665 needs.
666
667 .. _report-dictionary-label:
668
669 Report Dictionary
670 ----------------------------------
671
672 The report dictionary is a way to pre-define common filters you'd like
673 to apply to your reports. This is a good way to add in filters that the
674 report wizard doesn't include by default. To add a new definition, or
675 filter, click 'New Definition' on the Reports Dictionary page and follow
676 the 4 step process.
677
678 Step 1: Name the definition and provide a description if necessary
679
680 |image930|
681
682 Step 2: Choose the module that the will be queried.
683
684 |image931|
685
686 Step 3: Choose columns to query from the tables presented.
687
688 |image932|
689
690 Step 4: Choose the value(s) from the field(s). These will be
691 automatically populated with options available in your database.
692
693 |image933|
694
695 Confirm your selections to save the definition.
696
697 |image934|
698
699 Your definitions will all appear on the Reports Dictionary page
700
701 |image935|
702
703 Then when generating reports on the module you created the value for you
704 will see an option to limit by the definition at the bottom of the usual
705 filters.
706
707 |image936|