Bug 20706: Fixes the links to the manual to reflect chanced chapter file names
[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 <h3>Guided report wizard</h3>
6
7 <p>The guided report wizard will walk you through a six step process to generate a report.</p>
8
9 <p><strong>Step 1:</strong> Choose the module you want to report on. This will determine what tables and fields are available for you to query.</p>
10
11 <p>'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.</p>
12 <ul>
13     <li>A public report is accessible via a URL that looks like this: http://MYOPAC/cgi-bin/koha/svc/report?id=REPORTID</li>
14 </ul>
15 <p><strong>Step 2:</strong> Choose a report type. For now, Tabular is the only option available.</p>
16
17 <p><strong>Step 3:</strong> Choose the fields you want in your report. You can select multiple fields and add them all at once by using CTRL+Click on each item you want to add before clicking the Add button.</p>
18
19 <p><strong>Step 4:</strong> Choose any limits you might want to apply to your report (such as item types or branches). If you don't want to apply any limits, simply click Next instead of making an option.</p>
20
21 <p><strong>Step 5:</strong> Perform math functions. If you don't want to do any calculations, simply click Next instead of making an option.</p>
22
23 <p><strong>Step 6:</strong> Choose data order. If you want the data to print out in the order it's found in the database, simply click Finish.</p>
24
25 <p>When you are finished you will be presented with the SQL generated by the report wizard. From here you can choose to save the report by clicking 'Save' or copy the SQL and make edits to it by hand.</p>
26
27 <p>If you choose to save the report you will be asked to name your report, sort it in to groups and subgroups and enter any notes regarding it.</p>
28
29 <p>Once your report is saved it will appear on the 'Use Saved' page with all other saved reports.</p>
30
31 <p>From here you can make edits, run the report, or schedule a time to have the report run. To find the report you created you can sort by any of the columns by clicking the on the column header (creation date is the best bet for finding the report you just added). You can also filter your results using the filter menu on the left or use the tabs to find reports based on your custom groups.</p>
32
33 <h3>Report from SQL</h3>
34
35 <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="blank">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="blank">http://schema.koha-community.org</a>.</p>
36
37 <p>To add your query, click the link to 'Create from SQL' on the main reports module or the 'New report' button at the top of the 'Saved reports' page.</p>
38
39 <p>Fill in the form presented</p>
40 <ul>
41         <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>
42         <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 or can be added on the fly when creating the report by choosing the 'or create' radio button.
43 <ul>
44         <li style="background-color: #ffe599;">Tip: If you're adding a report group on the fly, remember that you code should be fewer than 10 characters and should not include special characters or spaces.</li>
45 </ul>
46 </li>
47         <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 or can be added on the fly when creating the report by choosing the 'or create' radio button.
48 <ul>
49         <li style="background-color: #ffe599;">Tip: If you're adding a report subgroup on the fly, remember that you code should be fewer than 10 characters and should not include special characters or spaces.</li>
50 </ul>
51 </li>
52         <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.
53 <ul>
54         <li>A public report is accessible via a URL that looks like this: http://MYOPAC/cgi-bin/koha/svc/report?id=REPORTID</li>
55 </ul>
56 </li>
57         <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>
58         <li>The type should always be 'Tabular' at this time since the other formats have not been implemented</li>
59         <li>In the 'SQL' box you will type or paste the SQL for the report</li>
60         <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;.
61 <ul>
62         <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>
63         <li>The 'Question to ask' will be displayed on the left of the string to enter.</li>
64         <li>The authorized_value can be omitted if not applicable. If it contains an authorized value category, or branches 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>
65 </ul>
66 </li>
67         <li>Examples:
68 <ul>
69         <li>SELECT surname,firstname FROM borrowers 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>
70         <li>SELECT * FROM items WHERE homebranch = &lt;&lt;Pick your branch|branches&gt;&gt; and barcode like &lt;&lt;Partial barcode value here&gt;&gt;</li>
71 </ul>
72 </li>
73         <li style="background-color: #ffe599;">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;
74 </li>
75         <li style="background-color: #ffe599;">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>
76         <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: Branches (branches), Item Types (itemtypes) and Patron Categories (categorycode). For example a branch pull down would be generated like this &lt;&lt;Branch|branches&gt;&gt;</li>
77 </ul>
78
79 <p><strong>Note</strong>: 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>
80
81 <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>
82
83 <h3>Duplicate Report</h3>
84
85 <p>Reports can also be added by duplicating an existing report. Visit the 'Saved reports' page to see all of the reports listed on your system.</p>
86
87 <p>To the right of every report there is an 'Actions' pull down. Clicking that and choose 'Duplicate' to use an existing report as the basis for your new report. That will populate the new report form with the existing SQL for easy editing and resaving.</p>
88
89 <h3>Edit Custom Reports</h3>
90
91 <p>Every report can be edited from the reports lists. To see the list of reports already stored in Koha, click 'Use Saved.'</p>
92
93 <p>To find the report you'd like to edit you can sort by any of the columns by clicking the on the column header. You can also filter your results using the filter menu on the left or use the tabs to find reports based on your custom groups.</p>
94
95 <p>From this list you can edit any custom report by clicking 'Actions' to the right of the report and choosing 'Edit' from the menu that appears.</p>
96
97 <p>The form to edit the report will appear.</p>
98
99 <h3>Running Custom Reports</h3>
100
101 <p>Once custom reports are saved to Koha, you can run them by going to the Saved Reports page and clicking the 'Actions' button to the right of the report and choosing 'Run'.</p>
102
103 <p>When you report runs you will either be asked for some values or you will see the results right away</p>
104
105 <p>From the results you can choose to rerun the report by clicking 'Run report' at the top, edit the report by clicking the 'Edit' button or starting over and creating a new report by using the 'New' button. You can also download your results by choosing a file type at the bottom of the results next to the 'Download the report' label and clicking 'Download.'</p>
106
107 <p style="background-color: #ffe599;">Tip:  A Comma Separated Text file is a CSV file and it can be opened by any spreadsheet application.</p>
108
109 <h3>DB table value for reports</h3>
110
111 <p><strong>Question:</strong> What do the codes in the accounttype field in the accountlines table stand for?</p>
112
113 <p><strong>Answer:</strong></p>
114
115 <ul>
116         <li>A = Account management fee</li>
117         <li>C = Credit</li>
118         <li>F = Overdue fine</li>
119         <li>FOR = Forgiven</li>
120         <li>FU = Overdue, still acccruing</li>
121         <li>L = Lost item</li>
122         <li>LR = Lost item returned/refunded</li>
123         <li>M = Sundry</li>
124         <li>N = New card</li>
125         <li>PAY = Payment</li>
126         <li>W = Writeoff</li>
127 </ul>
128
129 <p><strong>Question:</strong> What are the possible codes for the type field in the statistics table?</p>
130
131 <p><strong>Answer:</strong></p>
132
133 <ul>
134         <li>localuse
135 <ul>
136         <li>Registers if an item that had been checked out to a statistics patron (category type = 'X') is returned</li>
137 </ul>
138 </li>
139         <li>issue</li>
140         <li>return</li>
141         <li>renew</li>
142         <li>writeoff</li>
143         <li>payment</li>
144         <li>CreditXXX
145 <ul>
146         <li>The XXX stores different types of fee credits, so a query to catch them all would include a clause like "type LIKE 'Credit%'"</li>
147 </ul>
148 </li>
149 </ul>
150
151 <p><strong>Question</strong>: What are the possible codes for the found field in the reserves and old_reserves tables?</p>
152
153 <p><strong>Answer</strong>:</p>
154
155 <ul>
156         <li>NULL: means the patron requested the 1st available, and we haven't chosen the item</li>
157         <li>T = Transit: the reserve is linked to an item but is in transit to the pickup branch</li>
158         <li>W = Waiting: the reserve is linked to an item, is at the pickup branch, and is waiting on the hold shelf</li>
159         <li>F = Finished: the reserve has been completed, and is done</li>
160 </ul>
161
162 <p><strong>Question</strong>: What are the possible codes for the area field in the reports_dictionary table?</p>
163
164 <p><strong>Answer</strong>:</p>
165
166 <ul>
167         <li>1 = Circulation</li>
168         <li>2 = Catalog</li>
169         <li>3 = Patrons</li>
170     <li>4 = Acquisitions</li>
171         <li>5 = Accounts</li>
172 </ul>
173
174 <p><strong>Question</strong>: What are the possible codes for the message_type field in the messages table?</p>
175
176 <p><strong>Answer</strong>:</p>
177
178 <ul>
179         <li>L = For Librarians</li>
180         <li>B = For Patrons/Borrowers</li>
181 </ul>
182
183 <p><strong>Question</strong>: What are the possible codes for the status field in the serial table?</p>
184
185 <p><strong>Answer</strong>:</p>
186
187 <ul>
188         <li>1 = Expected</li>
189         <li>2 = Arrived</li>
190         <li>3 = Late</li>
191         <li>4 = Missing</li>
192         <li>5 = Not Available</li>
193         <li>6 = Delete</li>
194         <li>7 = Claimed</li>
195         <li>8 = Stopped</li>
196 </ul>
197
198 <p><strong>See the full documentation for Custom Reports in the <a href="http://koha-community.org/manual/[% helpVersion %]/html/reports.html#custom-reports">manual</a> (online).</strong></p>
199
200 [% INCLUDE 'help-bottom.inc' %]