]> git.evergreen-ils.org Git - working/Evergreen.git/blob - docs/reports/reporter_create_templates.txt
Translation updates - po files
[working/Evergreen.git] / docs / reports / reporter_create_templates.txt
1 [[reporter_creating_templates]]
2 Creating Templates
3 ------------------
4
5 indexterm:[reports, creating templates]
6
7 Once you have created a folder, the next step in building a report is to create 
8 or clone a template. Templates allow you to run a report more than once without 
9 building it anew every time, by changing definitions to suit current 
10 requirements. For example, you can create a shared template that reports on 
11 circulation at a given library. Then, other libraries can use your template and 
12 simply select their own library when they run the report.
13
14 It may take several tries to refine a report to give the output that you want. 
15 It can be useful to plan out your report on paper before getting started with 
16 the reporting tool. Group together related fields and try to identify the key 
17 fields that will help you select the correct source.
18
19 It may be useful to create complex queries in several steps. For example, first 
20 add all fields from the table at the highest source level. Run a report and check 
21 to see that you get results that seem reasonable. Then clone the report, add any 
22 filters on fields at that level and run another report. Then drill down to the 
23 next table and add any required fields. Run another report. Add any filters at 
24 that level. Run another report. Continue until you’ve drilled down to all the 
25 fields you need and added all the filters. This might seem time consuming and 
26 you will end up cloning your initial report several times. However, it will help 
27 you to check the correctness of your results, and will help to debug if you run 
28 into problems because you will know exactly what changes caused the problem. 
29 Also consider adding extra fields in the intermediate steps to help you check 
30 your results for correctness.
31
32 This example illustrates creating a template for circulation statistics. This is 
33 an example of the most basic template that you can create. The steps required to 
34 create a template are the same every time, but the tables chosen, how the data 
35 is transformed and displayed, and the filters used will vary depending on your 
36 needs.
37
38 Choosing Report Fields
39 ~~~~~~~~~~~~~~~~~~~~~~
40
41 indexterm:[reports, creating templates, choosing reports fields]
42
43 . Click on the My Folder template folder where you want the template to be saved.
44 +
45 image::media/create-template-1.png[create-template-1]
46 +
47 . Click on Create a new Template for this folder.
48 +
49 image::media/create-template-2.png[create-template-2]
50 +
51 . You can now see the template creating interface. The upper half of the screen 
52 is the _Database Source Browser_. The top left hand pane contains the database 
53 _Sources_ drop-down list. This is the list of tables available as a starting point 
54 for your report. Commonly used sources are _Circulation_ (for circ stats and 
55 overdue reports), _ILS User_ (for patron reports), and _Item_ (for reports on a 
56 library's holdings).
57 +
58 image::media/create-template-3.png[create-template-3]
59 +
60 The Enable source nullability checkbox below the sources list is for advanced 
61 reporting and should be left unchecked by default.
62 +
63 . Select _Circulation_ in the _Sources_ dropdown menu. Note that the _Core 
64 Sources_ for reporting are listed first, however it is possible to access all 
65 available sources at the bottom of this dropdown menu. You may only specify one 
66 source per template.
67 +
68 image::media/create-template-4.png[create-template-4]
69 +
70 . Click on _Circulation_ to retrieve all the field names in the Field Name pane. 
71 Note that the _Source_ Specifier (above the middle and right panes) shows the 
72 path that you took to get to the specific field.
73 +
74 image::media/create-template-5.png[create-template-5]
75 +
76 . Select _Circ ID_ in the middle _Field Name_ pane, and _Count Distinct_ from the 
77 right _Field Transform_ pane. The _Field Transform_ pane is where you choose how 
78 to manipulate the data from the selected fields. You are counting the number of 
79 circulations.
80 +
81 indexterm:[reports, field transform]
82 +
83 image::media/create-template-6.png[create-template-6]
84 +
85 _Field Transforms_ have either an _Aggregate_ or _Non-Aggregate_ output type. 
86 See the section called <<field_transforms,Field Transforms>> for more about 
87 _Count, _Count Distinct_, and other transform options.
88 +
89 . Click _Add Selected Fields_ underneath the _Field Transform_ pane to add this 
90 field to your report output. Note that _Circ ID_ now shows up in the bottom left 
91 hand pane under the _Displayed Fields_ tab.
92 +
93 image::media/create-template-7.png[create-template-7]
94 +
95 . _Circ ID_ will be the column header in the report output. You can rename 
96 default display names to something more meaningful. To do so in this example, 
97 select the _Circ ID_ row and click _Alter Display Header_.
98 +
99 image::media/create-template-8.png[create-template-8]
100 +
101 Double-clicking on the displayed field name is a shortcut to altering the 
102 display header.
103 +
104 . Type in the new column header name, for example _Circ count_ and click _OK_.
105 +
106 image::media/create-template-9.png[create-template-9]
107 +
108 . Add other data to your report by going back to the _Sources_ pane and selecting 
109 the desired fields. In this example, we are going to add _Circulating Item --> 
110 Shelving Location_ to further refine the circulation report.
111 +
112 In the top left hand _Sources_ pane, expand _Circulation_. Depending on your 
113 computer you will either click on the _+_ sign or on an arrow to expand the tree.
114 +
115 image::media/create-template-10.png[create-template-10]
116 +
117 Click on the _+_ or arrow to expand _Circulating Item_. Select 
118 _Shelving Location_.
119 +
120 image::media/create-template-11.png[create-template-11]
121 +
122 When you are creating a template take the shortest path to the field you need in 
123 the left hand Sources pane. Sometimes it is possible to find the same field name 
124 further in the file structure, but the shortest path is the most efficient.
125 +
126 In the Field Name pane select Name.
127 +
128 image::media/create-template-12.png[create-template-12]
129 +
130 In the upper right _Field Transform_ pane, select _Raw Data_ and click _Add Selected_ 
131 Fields. Use _Raw Data_ when you do not wish to transform field data in any manner.
132 +
133 image::media/create-template-13.png[create-template-13]
134 +
135 Name will appear in the bottom left pane. Select the Name row and click _Alter 
136 Display Header_.
137 +
138 image::media/create-template-15.png[create-template-15]
139 +
140 . Enter a new, more descriptive column header, for example, _Shelving location_. 
141 Click _OK_.
142 +
143 image::media/create-template-16.png[create-template-16]
144 +
145 . Note that the order of rows (top to bottom) will correspond to the order of 
146 columns (left to right) on the final report. Select _Shelving location_ and click 
147 on _Move Up_ to move _Shelving location_ before _Circ count_.
148 +
149 image::media/create-template-17.png[create-template-17]
150 +
151 . Return to the _Sources_ pane to add more fields to your template. Under 
152 _Sources_ click _Circulation_, then select _Check Out Date/Time_ from the middle 
153 _Field Name_ pane.
154 +
155 image::media/create-template-19.png[create-template-19]
156 +
157 . Select _Year + Month_ in the right hand _Field Transform_ pane and click _Add 
158 Selected Fields_
159 +
160 image::media/create-template-20.png[create-template-20]
161 +
162 . _Check Out Date/Time_ will appear in the _Displayed Fields_ pane. In the report 
163 it will appear as a year and month _(YYYY-MM)_ corresponding to the selected tranform.
164 +
165 image::media/create-template-21.png[create-template-21]
166 +
167 . Select the _Check Out Date/Time_ row. Click _Alter Display Header_ and change 
168 the column header to _Check out month_.
169 +
170 image::media/create-template-22.png[create-template-22]
171 +
172 . Move _Check out month_ to the top of the list using the _Move Up_ button, so 
173 that it will be the first column in an MS Excel spreadsheet or in a chart. 
174 Report output will sort by the first column.
175
176 image::media/create-template-23.png[create-template-23]
177
178 [NOTE]
179 ======
180 Note the _Change Transform_ button in the bottom left hand pane. It has the same 
181 function as the upper right _Field Transform_ pane for fields that have already 
182 been added.
183
184 image::media/create-template-24.png[create-template-24]
185 ======
186
187
188 Applying Filters
189 ~~~~~~~~~~~~~~~~
190
191 indexterm:[reports, applying filters]
192
193 Evergreen reports access the entire database, so to limit report output to a 
194 single library or library system you need to apply filters.
195
196 After following the steps in the previous section you will see three fields in 
197 the bottom left hand _Template Configuration_ pane. There are three tabs in this 
198 pane: _Displayed Fields_ (covered in the previous section), _Base Filters_ and 
199 _Aggregate Filters_. A filter allows you to return only the results that meet 
200 the criteria you set.
201
202 indexterm:[reports, applying filters, base filter]
203
204 indexterm:[reports, applying filters, aggregate filters]
205
206 _Base Filters_ apply to non-aggregate output types, while _Aggregate Filters_ are 
207 used for aggregate types. In most reports you will be using the _Base Filters_ tab. 
208 For more information on aggregate and non-aggregate types see the section called 
209 “Field Transforms”.
210
211 There are many available operators when using filters. Some examples are _Equals_, 
212 _In list_, is _NULL_, _Between_, _Greater than_ or _equal to_, and so on. _In list_ 
213 is the most flexible operator, and in this case will allow you flexibility when 
214 running a report from this template. For example, it would be possible to run a 
215 report on a list of timestamps (in this case will be trimmed to year and month 
216 only), run a report on a single month, or run a report comparing two months. It 
217 is also possible to set up recurring reports to run at the end of each month.
218
219 In this example we are going to use a Base Filter to filter out one library’s 
220 circulations for a specified time frame. The time frame in the template will be 
221 configured so that you can change it each time you run the report.
222
223 Using Base Filters
224 ^^^^^^^^^^^^^^^^^^
225
226 indexterm:[reports, applying filters, base filter]
227
228 . Select the _Base Filters_ tab in the bottom _Template Configuration_ pane.
229
230 . For this circulation statistics example, select _Circulation --> Check Out 
231 Date/Time --> Year + Month_ and click on _Add Selected Fields_. You are going to 
232 filter on the time period.
233 +
234 image::media/create-template-25.png[create-template-25]
235 +
236 . Select _Check Out Date/Time_. Click on _Change Operator_ and select _In list_ 
237 from the dropdown menu. 
238 +
239 image::media/create-template-26.png[create-template-26]
240 +
241 . To filter on the location of the circulation select 
242 _Circulation --> Circulating library --> Raw Data_ and click on _Add Selected Fields_.
243 +
244 image::media/create-template-27.png[create-template-276]
245 +
246 . Select _Circulating Library_ and click on _Change Operator_ and select _Equals_. 
247 Note that this is a template, so the value for _Equals_ will be filled out when 
248 you run the report.
249 +
250 image::media/create-template-28.png[create-template-28]
251 +
252 For multi-branch libraries, you would select _Circulating Library_ with _In list_ 
253 as the operator, so you could specify the branch(es) when you run the report. This 
254 leaves the template configurable to current requirements. In comparison, sometimes 
255 you will want to hardcode true/false values into a template. For example, deleted 
256 bibliographic records remain in the database, so perhaps you want to hardcode 
257 _deleted=false_, so that deleted records don’t show up in the results. You might 
258 want to use _deleted=true_, for a template for a report on deleted items in the 
259 last month.
260 +
261 . Once you have configured your template, you must name and save it. Name this 
262 template _Circulations by month for one library_. You can also add a description. 
263 In this example, the title is descriptive enough, so a description is not necessary. 
264 Click _Save_.
265 +
266 image::media/create-template-29.png[create-template-29]
267 +
268 . Click _OK_.
269 +
270 image::media/create-template-30.png[create-template-30]
271 +
272 . You will get a confirmation dialogue box that the template was successfully 
273 saved. Click OK.
274 +
275 image::media/create-template-31.png[create-template-31]
276 +
277 After saving it is not possible to edit a template. To make changes you will 
278 need to clone it and edit the clone
279
280 [NOTE]
281 ==========
282 The bottom right hand pane is also a source specifier. By selecting one of these 
283 rows you will limit the fields that are visible to the sources you have specified. 
284 This may be helpful when reviewing templates with many fields. Use *Ctrl+Click* to 
285 select or deselect items.
286
287 image::media/create-template-32.png[create-template-32]
288 ==========
289
290
291