]> git.evergreen-ils.org Git - Evergreen.git/blob - docs-antora/modules/reports/pages/reporter_create_templates.adoc
LP#1848524: Docs: Fix sections for Antora: "reports"
[Evergreen.git] / docs-antora / modules / reports / pages / reporter_create_templates.adoc
1 [[reporter_creating_templates]]
2 = Creating Templates =
3 :toc:
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 indexterm:[reports, creating templates, choosing reports fields]
41
42 . Click on the My Folder template folder where you want the template to be saved.
43 +
44 image::media/create-template-1.png[create-template-1]
45 +
46 . Click on Create a new Template for this folder.
47 +
48 image::media/create-template-2.png[create-template-2]
49 +
50 . You can now see the template creating interface. The upper half of the screen 
51 is the _Database Source Browser_. The top left hand pane contains the database 
52 _Sources_ drop-down list. This is the list of tables available as a starting point 
53 for your report. Commonly used sources are _Circulation_ (for circ stats and 
54 overdue reports), _ILS User_ (for patron reports), and _Item_ (for reports on a 
55 library's holdings).
56 +
57 image::media/create-template-3.png[create-template-3]
58 +
59 The Enable source nullability checkbox below the sources list is for advanced 
60 reporting and should be left unchecked by default.
61 +
62 . Select _Circulation_ in the _Sources_ dropdown menu. Note that the _Core 
63 Sources_ for reporting are listed first, however it is possible to access all 
64 available sources at the bottom of this dropdown menu. You may only specify one 
65 source per template.
66 +
67 image::media/create-template-4.png[create-template-4]
68 +
69 . Click on _Circulation_ to retrieve all the field names in the Field Name pane. 
70 Note that the _Source_ Specifier (above the middle and right panes) shows the 
71 path that you took to get to the specific field.
72 +
73 image::media/create-template-5.png[create-template-5]
74 +
75 . Select _Circ ID_ in the middle _Field Name_ pane, and _Count Distinct_ from the 
76 right _Field Transform_ pane. The _Field Transform_ pane is where you choose how 
77 to manipulate the data from the selected fields. You are counting the number of 
78 circulations.
79 +
80 indexterm:[reports, field transform]
81 +
82 image::media/create-template-6.png[create-template-6]
83 +
84 _Field Transforms_ have either an _Aggregate_ or _Non-Aggregate_ output type. 
85 See the section called
86 xref:reports:reporter_template_terminology.adoc#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 transform.
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 indexterm:[reports, applying filters]
191
192 Evergreen reports access the entire database, so to limit report output to a 
193 single library or library system you need to apply filters.
194
195 After following the steps in the previous section you will see three fields in 
196 the bottom left hand _Template Configuration_ pane. There are three tabs in this 
197 pane: _Displayed Fields_ (covered in the previous section), _Base Filters_ and 
198 _Aggregate Filters_. A filter allows you to return only the results that meet 
199 the criteria you set.
200
201 indexterm:[reports, applying filters, base filter]
202
203 indexterm:[reports, applying filters, aggregate filters]
204
205 _Base Filters_ apply to non-aggregate output types, while _Aggregate Filters_ are 
206 used for aggregate types. In most reports you will be using the _Base Filters_ tab. 
207 For more information on aggregate and non-aggregate types see the section called 
208 “Field Transforms”.
209
210 There are many available operators when using filters. Some examples are _Equals_, 
211 _In list_, is _NULL_, _Between_, _Greater than_ or _equal to_, and so on. _In list_ 
212 is the most flexible operator, and in this case will allow you flexibility when 
213 running a report from this template. For example, it would be possible to run a 
214 report on a list of timestamps (in this case will be trimmed to year and month 
215 only), run a report on a single month, or run a report comparing two months. It 
216 is also possible to set up recurring reports to run at the end of each month.
217
218 In this example we are going to use a Base Filter to filter out one library’s 
219 circulations for a specified time frame. The time frame in the template will be 
220 configured so that you can change it each time you run the report.
221
222 === Using Base Filters ===
223
224 indexterm:[reports, applying filters, base filter]
225
226 . Select the _Base Filters_ tab in the bottom _Template Configuration_ pane.
227
228 . For this circulation statistics example, select _Circulation --> Check Out 
229 Date/Time --> Year + Month_ and click on _Add Selected Fields_. You are going to 
230 filter on the time period.
231 +
232 image::media/create-template-25.png[create-template-25]
233 +
234 . Select _Check Out Date/Time_. Click on _Change Operator_ and select _In list_ 
235 from the dropdown menu. 
236 +
237 image::media/create-template-26.png[create-template-26]
238 +
239 . To filter on the location of the circulation select 
240 _Circulation --> Circulating library --> Raw Data_ and click on _Add Selected Fields_.
241 +
242 image::media/create-template-27.png[create-template-276]
243 +
244 . Select _Circulating Library_ and click on _Change Operator_ and select _Equals_. 
245 Note that this is a template, so the value for _Equals_ will be filled out when 
246 you run the report.
247 +
248 image::media/create-template-28.png[create-template-28]
249 +
250 For multi-branch libraries, you would select _Circulating Library_ with _In list_ 
251 as the operator, so you could specify the branch(es) when you run the report. This 
252 leaves the template configurable to current requirements. In comparison, sometimes 
253 you will want to hardcode true/false values into a template. For example, deleted 
254 bibliographic records remain in the database, so perhaps you want to hardcode 
255 _deleted=false_, so that deleted records don’t show up in the results. You might 
256 want to use _deleted=true_, for a template for a report on deleted items in the 
257 last month.
258 +
259 . Once you have configured your template, you must name and save it. Name this 
260 template _Circulations by month for one library_. You can also add a description. 
261 In this example, the title is descriptive enough, so a description is not necessary. 
262 Click _Save_.
263 +
264 image::media/create-template-29.png[create-template-29]
265 +
266 . Click _OK_.
267 +
268 image::media/create-template-30.png[create-template-30]
269 +
270 . You will get a confirmation dialogue box that the template was successfully 
271 saved. Click OK.
272 +
273 image::media/create-template-31.png[create-template-31]
274 +
275 After saving it is not possible to edit a template. To make changes you will 
276 need to clone it and edit the clone
277
278 [NOTE]
279 ==========
280 The bottom right hand pane is also a source specifier. By selecting one of these 
281 rows you will limit the fields that are visible to the sources you have specified. 
282 This may be helpful when reviewing templates with many fields. Use *Ctrl+Click* to 
283 select or deselect items.
284
285 image::media/create-template-32.png[create-template-32]
286 ==========
287
288
289