]> git.evergreen-ils.org Git - working/Evergreen.git/blob - docs/reports/reporter_template_terminology.txt
2cba161ab15e5ef1cc090725932c885e4bf81ae4
[working/Evergreen.git] / docs / reports / reporter_template_terminology.txt
1 Template Terminology
2 --------------------
3
4 Data Types
5 ~~~~~~~~~~
6
7 indexterm:[reports, data types]
8
9 The central column of the _Database Source Browser_ lists _Field Name_ and _Data 
10 Type_ for the selected database table.
11
12 +
13 image::media/view-output-2.png[view-output-2]
14 +
15
16 Each data type has its own characteristics and uses:
17
18 [options="header,footer"]
19 |====================================
20 |Data Type      |Description    |Notes
21 |id             |Unique number assigned by the database to identify a 
22 record  |A number that is a meaningful reference for the database but not 
23 of much use to a human user. Use in displayed fields when counting records or 
24 in filters.
25 |text   |Text field     |Usually uses the Raw Data transform.
26 |timestamp      |Exact date and time    |Select appropriate date/time transform. 
27 Raw Data includes second and timezone information, usually more than is required 
28 for a report.
29 |bool   |True or False  |Commonly used to filter out deleted item or patron records.
30 |org_unit       |A number representing a library, library system, or 
31 federation      |When you want to filter on a library, make sure that the field 
32 name is on an org_unit or id data type.
33 |link   |A link to another database table       |Link outputs a number that is a 
34 meaningful reference for the database but not of much use to a human user. You 
35 will usually want to drill further down the tree in the Sources pane and select 
36 fields from the linked table. However, in some instances you might want to use 
37 a link field. For example, to count the number of patrons who borrowed items you 
38 could do a count on the Patron link data.
39 |int    |Integer         
40 |money  |Number (in dollars)     
41 |=====================================
42
43 [[field_transforms]]
44 Field Transforms
45 ~~~~~~~~~~~~~~~~
46
47 indexterm:[reports, field transforms]
48
49 A _Field Transform_ tells the reporter how to process a field for output. 
50 Different data types have different transform options.
51
52 indexterm:[reports, field transforms, raw data]
53
54 *Raw Data*.  To display a field exactly as it appears in the database use the 
55 _Raw Data_ transform, available for all data types.
56
57 indexterm:[reports, field transforms, count]
58
59 indexterm:[reports, field transforms, raw distinct]
60
61 *Count and Count Distinct*.  These transforms apply to the _id_ data type and 
62 are used to count database records (e.g. for circulation statistics). Use Count 
63 to tally the total number of records. Use _Count Distinct_ to count the number 
64 of unique records, removing duplicates.
65
66 To demonstrate the difference between _Count_ and _Count Distinct_, consider an 
67 example where you want to know the number of active patrons in a given month, 
68 where ``active" means they borrowed at least one item. Each circulation is linked 
69 to a _Patron ID_, a number identifying the patron who borrowed the item. If we use 
70 the _Count Distinct_ transform for Patron IDs we will know the number of unique 
71 patrons who circulated at least one book (2 patrons in the table below). If 
72 instead, we use _Count_, we will know how many books were circulated, since every 
73 circulation is linked to a _patron ID_ and duplicate values are also counted. To 
74 identify the number of active patrons in this example the _Count Distinct_ 
75 transform should be used.
76
77 [options="header,footer"]
78 |====================================
79 |Title  |Patron ID      |Patron Name
80 |Harry Potter and the Chamber of Secrets        |001    |John Doe
81 |Northern Lights        |001    |John Doe
82 |Harry Potter and the Philosopher’s Stone     |222    |Jane Doe
83 |====================================
84
85 indexterm:[reports, field transforms, output type]
86
87 *Output Type*.  Note that each transform has either an _Aggregate_ or 
88 _Non-Aggregate_ output type.
89
90 indexterm:[reports, field transforms, output type, non-aggregate]
91
92 indexterm:[reports, field transforms, output type, aggregate]
93
94 Selecting a _Non-Aggregate_ output type will return one row of output in your 
95 report for each row in the database. Selecting an Aggregate output type will 
96 group together several rows of the database and return just one row of output 
97 with, say, the average value or the total count for that group. Other common 
98 aggregate types include minimum, maximum, and sum.
99
100 When used as filters, non-aggregate and aggregate types correspond to _Base_ and 
101 _Aggregate_ filters respectively. To see the difference between a base filter and 
102 an aggregate filter, imagine that you are creating a report to count the number 
103 of circulations in January. This would require a base filter to specify the 
104 month of interest because the month is a non-aggregate output type. Now imagine 
105 that you wish to list all items with more than 25 holds. This would require an 
106 aggregate filter on the number of holds per item because you must use an 
107 aggregate output type to count the holds.
108