Mana configuration and reports (Taiga 821 and 825)
[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 choosing 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 choosing 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     **Note**
180
181     If your system administrator has set up memcache on your server you
182     might see one more option for the Cache expiry. This is related to
183     your public reports. If you make the report public then it's
184     constantly running and will cause a large load on your system.
185     Setting this value prevents that.
186
187     |image1294|
188
189 Once everything is entered click the 'Save report' button and you'll be
190 presented with options to run it. Once a report is saved you do not have
191 to recreate it you can simply find it on the Saved Reports page and
192 :ref:`run <running-custom-reports-label>` or :ref:`edit <edit-custom-reports-label>` it.
193
194 .. _report-writing-tips-label:
195
196 Report writing tips
197 '''''''''''''''''''''''''''''''''''''
198
199 **Runtime parameters**
200
201
202 If you feel that your report might be too resource intensive you
203 might want to consider using runtime parameters to your query.
204 Runtime parameters basically make a filter appear before the report
205 is run to save your system resources.
206
207 There is a specific syntax that Koha will understand as 'ask for
208 values when running the report'. The syntax is <<Question to
209 ask\|authorized\_value>>.
210
211 -  The << and >> are just delimiters. You must put << at the
212    beginning and >> at the end of your parameter
213
214 -  The 'Question to ask' will be displayed on the left of the string
215    to enter.
216
217 -  The authorized\_value can be omitted if not applicable. If it
218    contains an authorized value category, 'branches', 'itemtype', 
219    'categorycode', 'biblio\_framework', a list with the Koha authorized
220    values will be displayed instead of a free field.
221
222        **Note**
223
224        You can have more than one parameter in a given SQL query.
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        For example entering nothing for: "title=<<Enter title>>" will 
232        display results with title='' (no title).
233        If you want to have to have something not mandatory, use 
234        "title like <<Enter title>>" and enter a % at run time instead 
235        of nothing.
236
237        **Note**
238
239        To generate a date picker calendar to the right of the field when
240        running a report you can use the 'date' keyword like this:
241        <<Enter Date\|date>>
242
243        |image893|
244
245 List of parameters that can be used in runtime parameters
246
247 +-------------------------+---------------------------------------------------+------------------------------+
248 | Parameter               | What the user sees                                | What gets inserted in query  |
249 +-------------------------+---------------------------------------------------+------------------------------+
250 | date                    | date picker                                       | validly formatted date       |
251 | branches                | drop down of branch names                         | branch code                  |            
252 | itemtypes               | drop down of item type names                      | item type                    |
253 | categorycode            | drop down of patron category descriptions         | borrower category code       | 
254 | biblio\_framework       | drop down of MARC bibliographic frameworks        | framework code               |
255 | (auth-value-category)   | drop down of auth-value descriptions in category  | authorized value             |
256 | (nothing)               | text box                                          | entered text                 |
257 +-------------------------+---------------------------------------------------+------------------------------+
258
259 Examples:
260
261    -  SELECT surname, firstname FROM borrowers WHERE branchcode=<<Enter
262       patron's library\|branches>> AND surname like <<Enter filter for
263       patron surname (% if none)>>
264
265    -  SELECT \* FROM items WHERE homebranch = <<Pick your
266       branch\|branches>> and barcode like <<Partial barcode value here>>
267
268    -  SELECT title, author FROM biblio WHERE frameworkcode=<<Enter the
269       frameworkcode\|biblio\_framework>>
270
271
272 .. ****************************************
273 .. **************    TODO    **************
274 .. ****************************************
275
276 .. **Querying MARC**
277
278 .. It is possible to query the MARC records with the ExtractValue function.
279
280 .. **Links**
281
282 .. **Runtime variables**
283
284 .. **See more results**
285
286 .. There is a limit of 10,000 records put on SQL statements entered in 
287    Koha. To get around this you want to add 'LIMIT 100000' to the end
288    of your SQL statement (or any other number above 10,000).
289
290
291 .. _mana-SQL-report-label:
292
293 SQL report from Mana
294 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
295
296 In the "Create report from SQL", you can search Mana KB for pre-made reports 
297 by clicking on "New report" and choosing "New SQL from Mana".
298
299 |image1428|
300
301      **Note**
302
303      This option will only appear if you've :ref:`configured Mana KB 
304      <share-with-mana-kb-label>` in the administration module.
305
306 You will be prompted to enter keywords to search the knowledge base.
307
308 |image1429|
309
310 In the search results, you will see
311
312 -  the details of the report (name, notes and type)
313
314 -  how many people have used this entry (# of users)
315
316 -  when it was used for the last time (last import)
317
318 -  additional comments made by other Koha users (comments)
319
320 |image1430|
321
322 .. What does the orange mean??
323
324 Click on "Import" to import a copy of the report in your own saved reports.
325
326 You can then edit it, duplicate it, delete it, run it as you would any of 
327 your own reports.
328
329 .. _duplicate-report-label:
330
331 Duplicate report
332 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
333
334 Reports can also be added by duplicating an existing report. Visit the
335 'Saved reports' page to see all of the reports listed on your system
336 already.
337
338 |image895|
339
340 To the right of every report there is an 'Actions' pull down. Clicking
341 that and choose 'Duplicate' to use an existing report as the basis for
342 your new report. That will populate the new report form with the
343 existing SQL for easy editing and resaving.
344
345 .. _edit-custom-reports-label:
346
347 Edit custom reports
348 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
349
350 Every report can be edited from the reports lists. To see the list of
351 reports already stored in Koha, click 'Use saved.'
352
353 |image896|
354
355 To find the report you'd like to edit you can sort by any of the columns
356 by clicking the on the column header. You can also filter your results
357 using the filter menu on the left or use the tabs to find reports based
358 on your custom groups.
359
360 From this list you can edit any custom report by clicking 'Actions' to
361 the right of the report and choosing 'Edit' from the menu that appears.
362
363 |image897|
364
365 The form to edit the report will appear.
366
367 |image898|
368
369 .. _running-custom-reports-label:
370
371 Running custom reports
372 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
373
374 Once custom reports are saved to Koha, you can run them by going to the
375 Saved Reports page and clicking the 'Actions' button to the right of the
376 report and choosing 'Run'.
377
378 |image899|
379
380 When you report runs you will either be asked for some values
381
382 |image900|
383
384 or you will see the results right away
385
386 |image901|
387
388 From the results you can choose to rerun the report by clicking 'Run
389 report' at the top, edit the report by clicking the 'Edit' button or
390 starting over and creating a new report by using the 'New' button. You
391 can also download your results by choosing a file type at the bottom of
392 the results next to the 'Download the report' label and clicking
393 'Download.'
394
395     **Note**
396
397     A comma separated text file is a CSV file and it can be opened by
398     any spreadsheet application.
399
400 .. _send-itemnumbers-to-batch-item-modification-label:
401
402 Send itemnumbers to batch item modification
403 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
404
405 After running a report that contains itemnumbers the list of numbers can be imported
406 directly into :ref:`Batch item modification` by clicking the batch modify button
407 in the report results.
408
409 |image1343|
410
411 .. _statistics-reports-label:
412
413 Statistics reports
414 --------------------------------------
415
416 Statistic reports will show you counts and sums. These reports are all
417 about numbers and statistics, for reports that return more detailed
418 data, use the :ref:`guided report wizard`. These
419 reports are limited in what data they can look at, so it's often
420 recommended to use :ref:`custom reports <custom-reports-label>` for official end
421 of the year statistics.
422
423 .. _acquisitions-statistics-label:
424
425 Acquisitions statistics
426 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
427
428     **Note**
429
430     These reports are limited in what data they can look at, so it's
431     often recommended to use :ref:`custom reports <custom-reports-label>` for
432     official end of the year statistics.
433
434 Using the form provided, choose which value you would like to appear in
435 the column and which will appear in the row.
436
437 |image902|
438
439 If you choose to output to the browser your results will print to the
440 screen.
441
442 |image903|
443
444 You can also choose to export to a file that you can manipulate to your
445 needs.
446
447 When generating your report, note that you get to choose between
448 counting or summing the values.
449
450 |image904|
451
452 Choosing amount will change your results to appear as the sum of the
453 amounts spent.
454
455 |image905|
456
457 .. _patron-statistics-label:
458
459 Patron statistics
460 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
461
462     **Note**
463
464     These reports are limited in what data they can look at, so it's
465     often recommended to use :ref:`custom reports <custom-reports-label>` for
466     official end of the year statistics.
467
468 Using the form provided, choose which value you would like to appear in
469 the column and which will appear in the row.
470
471 |image906|
472
473 If you choose to output to the browser your results will print to the
474 screen.
475
476 |image907|
477
478 Based on your selections, you may see some query information above your
479 results table. You can also choose to export to a file that you can
480 manipulate to your needs.
481
482 .. _catalog-statistics-label:
483
484 Catalog statistics
485 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
486
487     **Note**
488
489     These reports are limited in what data they can look at, so it's
490     often recommended to use :ref:`custom reports <custom-reports-label>` for
491     official end of the year statistics.
492
493 Using the form provided, choose which value you would like to appear in
494 the column and which will appear in the row.
495
496 |image908|
497
498 If you choose to output to the browser your results will print to the
499 screen.
500
501 |image909|
502
503 You can also choose to export to a file that you can manipulate to your
504 needs.
505
506 .. _circulation-statistics-label:
507
508 Circulation statistics
509 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
510
511     **Note**
512
513     These reports are limited in what data they can look at, so it's
514     often recommended to use :ref:`custom reports <custom-reports-label>` for
515     official end of the year statistics.
516
517 Using the form provided, choose which value you would like to appear in
518 the column and which will appear in the row.
519
520 |image910|
521
522 If you choose to output to the browser your results will print to the
523 screen.
524
525 |image911|
526
527 You can also choose to export to a file that you can manipulate to your
528 needs.
529
530     **Note**
531
532     To get a complete picture of your monthly or daily circulation, you
533     can run the report twice, once for 'Type' of 'Checkout' and again
534     for 'Renewal.'
535
536     This report uses 'Period,' or date, filtering that allows you to
537     limit to a month by simply selecting the first day of the first
538     month through the first day of the next month. For example, 10/1 to
539     11/1 to find statistics for the month of October.
540
541     -  To find daily statistics, set your date range.</br> Example: "I
542        want circulation data starting with date XXX up to, but not
543        including, date XXX."
544
545     -  For a whole month, an example range would be: 11/01/2009 to
546        12/01/2009
547
548     -  For a whole year, an example range would be: 01/01/2009 to
549        01/01/2010
550
551     -  For a single day, an example would be: 11/15/2009 to 11/16/2009
552        to find what circulated on the 15th
553
554 .. _tracking-in-house-use-label:
555
556 Tracking in house use
557 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
558
559 Using the Circulation statistics reporting wizard you can run reports on
560 in house usage of items simply by choosing 'Local use' from the 'Type'
561 pull down:
562
563 |image912|
564
565 .. _serials-statistics-label:
566
567 Serials statistics
568 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
569
570     **Note**
571
572     These reports are limited in what data they can look at, so it's
573     often recommended to use :ref:`custom reports <custom-reports-label>` for
574     official end of the year statistics.
575
576 Using the form provided, choose how you would like to list the serials
577 in your system.
578
579 |image913|
580
581 If you choose to output to the browser your results will print to the
582 screen.
583
584 |image914|
585
586 You can also choose to export to a file that you can manipulate to your
587 needs.
588
589 .. _holds-statistics-label:
590
591 Holds statistics
592 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
593
594     **Note**
595
596     These reports are limited in what data they can look at, so it's
597     often recommended to use :ref:`custom reports <custom-reports-label>` for
598     official end of the year statistics.
599
600 Using the form provided you can see statistics for holds placed, filled,
601 cancelled and more at your library. From the form choose what value you
602 want to display in the column and what value to show in the row. You can
603 also choose from the filters on the far right of the form.
604
605 |image915|
606
607 If you choose to output to the browser your results will print to the
608 screen.
609
610 |image916|
611
612 You can also choose to export to a file that you can manipulate to your
613 needs.
614
615 .. _patrons-with-the-most-checkouts-label:
616
617 Patrons with the most checkouts
618 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
619
620 This report will simply list the patrons who have the most checkouts.
621
622 |image917|
623
624 If you choose to output to the browser your results will print to the
625 screen.
626
627 |image918|
628
629 You can also choose to export to a file that you can manipulate to your
630 needs.
631
632 .. _most-circulated-items-label:
633
634 Most circulated items
635 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
636
637 This report will simply list the items that have the been checked out
638 the most.
639
640 |image919|
641
642 If you choose to output to the browser your results will print to the
643 screen.
644
645 |image920|
646
647 You can also choose to export to a file that you can manipulate to your
648 needs.
649
650 .. _patrons-with-no-checkouts-label:
651
652 Patrons with no checkouts
653 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
654
655 This report will list for you the patrons in your system who haven't
656 checked any items out.
657
658 |image921|
659
660 If you choose to output to the browser your results will print to the
661 screen.
662
663 |image922|
664
665 You can also choose to export to a file that you can manipulate to your
666 needs.
667
668 .. _items-with-no-checkouts-label:
669
670 Items with no checkouts
671 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
672
673 This report will list items in your collection that have never been
674 checked out.
675
676 |image923|
677
678 If you choose to output to the browser your results will print to the
679 screen.
680
681 |image924|
682
683 You can also choose to export to a file that you can manipulate to your
684 needs.
685
686 .. _catalog-by-item-type-label:
687
688 Catalog by item type
689 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
690
691 This report will list the total number of items of each item type per
692 branch.
693
694 |image925|
695
696 If you choose to output to the browser your results will print to the
697 screen.
698
699 |image926|
700
701 You can also choose to export to a file that you can manipulate to your
702 needs.
703
704 .. _lost-items-label:
705
706 Lost items
707 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
708
709 This report will allow you to generate a list of items that have been
710 marked as Lost within the system
711
712 |image927|
713
714 .. _average-loan-time-label:
715
716 Average loan time
717 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
718
719 This report will list the average time items are out on loan based on
720 the criteria you enter:
721
722 |image928|
723
724 If you choose to output to the browser your results will print to the
725 screen.
726
727 |image929|
728
729 You can also choose to export to a file that you can manipulate to your
730 needs.
731
732 .. _report-dictionary-label:
733
734 Report dictionary
735 ----------------------------------
736
737 The report dictionary is a way to pre-define common filters you'd like
738 to apply to your reports. This is a good way to add in filters that the
739 report wizard doesn't include by default. To add a new definition, or
740 filter, click 'New definition' on the reports dictionary page and follow
741 the 4 step process.
742
743 Step 1: Name the definition and provide a description if necessary
744
745 |image930|
746
747 Step 2: Choose the module that the will be queried.
748
749 |image931|
750
751 Step 3: Choose columns to query from the tables presented.
752
753 |image932|
754
755 Step 4: Choose the value(s) from the field(s). These will be
756 automatically populated with options available in your database.
757
758 |image933|
759
760 Confirm your selections to save the definition.
761
762 |image934|
763
764 Your definitions will all appear on the Reports Dictionary page
765
766 |image935|
767
768 Then when generating reports on the module you created the value for you
769 will see an option to limit by the definition at the bottom of the usual
770 filters.
771
772 |image936|