Bug 7731 [Follow-up] Library should be used instead of branch and site
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / help / reports / guided_reports.tt
1 [% INCLUDE 'help-top.inc' %]
2
3 <h1>Add a Custom Report</h1>
4
5 <h2>Guided Report Wizard</h2>
6
7 <p>If the report you need is not already available, the 'Guided Reports' Wizard will walk you through creating a custom report.</p>
8
9 <ul>
10 <li>Go to the 'Reports' module (usually under 'More' in your Global Nav)</li>
11 <li>Choose 'Guided Reports' under 'Guided Reports Wizard'</li>
12 </ul>
13
14 <p>Answer the 6 questions presented in order to create your report.</p>
15
16 <p><strong>Step 1: Choose a Module to Report on</strong></p>
17
18 <ul>
19 <li>Choose a Koha module to build a report on (patrons, circ, cataloging, etc)</li>
20 <li>Click 'Next'</li>
21 </ul>
22
23 <p><strong>Step 2: Pick a Report Type</strong></p>
24
25 <ul><li style="color: #990000">IMPORTANT: Only Tabular should be chosen with this option</li></ul>
26
27 <p><strong>Step 3: Select Columns for Display</strong></p>
28
29 <p><strong>Step 4: Select Criteria to Limit</strong></p>
30
31 <ul><li>This is optional, if you don't want to limit results by any one field, just leave this section blank.</li></ul>
32
33 <p><strong>Step 5: Pick which columns to perform mathmatical functions on</strong></p>
34
35 <ul><li>This is optional, if you don't want to do any math on the results, just leave this section blank.</li></ul>
36
37 <p><strong>Step 6: Choose how you want the report ordered</strong></p>
38
39 <ul><li>This is optional, if you want the results to come out as they are in the table, just leave this section blank.</li></ul>
40
41 <h2>Edit Reports</h2>
42
43 <p>Custom reports can be edited in their entirety from the Saved Guided Reports page.</p>
44
45 <ul><li><em>Get there:</em> More > Reports > Guided Reports > Use Saved</li></ul>
46
47 <ul>
48 <li>To edit a report click 'Edit SQL' beside the report</li>
49 <li>A page with editable fields will open so that you can change the title, notes and SQL related to the report</li>
50 </ul>
51
52 <h2>Report from SQL</h2>
53
54 <p>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: <a href="http://wiki.koha-community.org/wiki/SQL_Reports_Library" target="_top">http://wiki.koha-community.org/wiki/SQL_Reports_Library</a>. You can also find your database structure in /installer/data/mysql/kohastructure.sql or online at: <a href="http://schema.koha-community.org/" target="_top">http://schema.koha-community.org</a>.</p>
55
56 <p>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.</p>
57
58 <p>Fill in the form presented</p>
59 <ul>
60     <li>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.</li>
61     <li>You can use the 'Report group' to organize your reports so that you can easily filter reports by groups. Report groups are set in the REPORT_GROUP authorized value category.</li>
62     <li>You can use 'Report subgroup' to further organize your reports so that you can easily filter reports by groups and subgroups. Report subgroups are set in the REPORT_SUBGROUP authorized value category.</li>
63     <li>'Report is public' should be left to the default of 'No' in most cases. A report can be made public if you intend to allow access to it through the JSON webservice interface. This is a system that can be used by developers to make custom presentations of the data from the report, for example displaying it using a graphing API. To learn more speak to your local developer.
64 <ul>
65     <li>A public report is accessible via a URL that looks like this: http://MYOPAC/cgi-bin/koha/svc/report?id=REPORTID</li>
66 </ul>
67 </li>
68     <li>'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</li>
69     <li>The type should always be 'Tabular' at this time since theother formats have not been implemented</li>
70     <li>In the 'SQL' box you will type or paste the SQL for the report</li>
71     <li>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 &lt;&lt;Question to ask|authorized_value&gt;&gt;.
72 <ul>
73     <li>The &lt;&lt; and &gt;&gt; are just delimiters. You must put &lt;&lt; at the beginning and &gt;&gt; at the end of your parameter</li>
74     <li>The 'Question to ask' will be displayed on the left of the string to enter.</li>
75     <li>The authorized_value can be omitted if not applicable. If it contains an authorized value category, or libraries 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=&lt;&lt;Enter title&gt;&gt;" will display results with title='' (no title). If you want to have to have something not mandatory, use "title like &lt;&lt;Enter title&gt;&gt;" and enter a % at run time instead of nothing</li>
76 </ul>
77 <p>Examples:</p>
78 <ul>
79     <li>SELECT surname, firstname<br />
80 FROM borrowers <br />
81 WHERE branchcode=&lt;&lt;Enter patrons library|branches&gt;&gt; AND surname like &lt;&lt;Enter filter for patron surname (% if none)&gt;&gt;</li>
82     <li>SELECT * <br />
83 FROM items <br />
84 WHERE homebranch = &lt;&lt;Pick your library|branches&gt;&gt; AND barcode like &lt;&lt;Partial barcode value here&gt;&gt;</li>
85 </ul>
86 </li>
87     <li>Tip: To generate a date picker calendar to the right of the field when running a report you can use the 'date' keyword like this: &lt;&lt;Enter Date|date&gt;&gt;</li>
88     <li>Tip: 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.</li>
89     <li style="color: #990000">Important: In addition to using any authorized value code to generate a dropdown, you can use the following values as well: Libraries (branches), Item Types (itemtypes) and Patron Categories (categorycode). For example a library pull down would be generated like this &lt;&lt;Library|branches&gt;&gt;</li>
90 </ul>
91
92 <p>Note: 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.</p>
93
94 <p>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.</p>
95
96 <p><strong>Is there a repository for reports?</strong></p>
97
98 <p>There is a page on the Koha Wiki: <a href="http://wiki.koha-community.org/wiki/SQL_Reports_Library" target="_new">http://wiki.koha-community.org/wiki/SQL_Reports_Library</a> with reports written by Koha libraries around the world.</p>
99
100 <p>NEKLS also has a great page (<a href="http://www.nexpresslibrary.org/training/reports-training/" target="_new">http://www.nexpresslibrary.org/training/reports-training/</a>) with a list of reports they have written.</p>
101
102 <p><strong>See the full documentation for Custom Reports in the <a href="http://manual.koha-community.org/3.10/en/reports.html#customreports">manual</a> (online).</strong></p>
103
104 [% INCLUDE 'help-bottom.inc' %]