]> git.evergreen-ils.org Git - working/Evergreen.git/blob - docs/reports/reporter_template_terminology.txt
bb482b048612d054a3fee8f8bdf6be572639cf99
[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 ~~~~~~~~~~~~~~~~
45
46 indexterm:[reports, field transforms]
47
48 A _Field Transform_ tells the reporter how to process a field for output. 
49 Different data types have different transform options.
50
51 indexterm:[reports, field transforms, raw data]
52
53 *Raw Data*.  To display a field exactly as it appears in the database use the 
54 _Raw Data_ transform, available for all data types.
55
56 indexterm:[reports, field transforms, count]
57
58 indexterm:[reports, field transforms, raw distinct]
59
60 *Count and Count Distinct*.  These transforms apply to the _id_ data type and 
61 are used to count database records (e.g. for circulation statistics). Use Count 
62 to tally the total number of records. Use _Count Distinct_ to count the number 
63 of unique records, removing duplicates.
64
65 To demonstrate the difference between _Count_ and _Count Distinct_, consider an 
66 example where you want to know the number of active patrons in a given month, 
67 where ``active" means they borrowed at least one item. Each circulation is linked 
68 to a _Patron ID_, a number identifying the patron who borrowed the item. If we use 
69 the _Count Distinct_ transform for Patron IDs we will know the number of unique 
70 patrons who circulated at least one book (2 patrons in the table below). If 
71 instead, we use _Count_, we will know how many books were circulated, since every 
72 circulation is linked to a _patron ID_ and duplicate values are also counted. To 
73 identify the number of active patrons in this example the _Count Distinct_ 
74 transform should be used.
75
76 [options="header,footer"]
77 |====================================
78 |Title  |Patron ID      |Patron Name
79 |Harry Potter and the Chamber of Secrets        |001    |John Doe
80 |Northern Lights        |001    |John Doe
81 |Harry Potter and the Philosopher’s Stone     |222    |Jane Doe
82 |====================================
83
84 indexterm:[reports, field transforms, output type]
85
86 *Output Type*.  Note that each transform has either an _Aggregate_ or 
87 _Non-Aggregate_ output type.
88
89 indexterm:[reports, field transforms, output type, non-aggregate]
90
91 indexterm:[reports, field transforms, output type, aggregate]
92
93 Selecting a _Non-Aggregate_ output type will return one row of output in your 
94 report for each row in the database. Selecting an Aggregate output type will 
95 group together several rows of the database and return just one row of output 
96 with, say, the average value or the total count for that group. Other common 
97 aggregate types include minimum, maximum, and sum.
98
99 When used as filters, non-aggregate and aggregate types correspond to _Base_ and 
100 _Aggregate_ filters respectively. To see the difference between a base filter and 
101 an aggregate filter, imagine that you are creating a report to count the number 
102 of circulations in January. This would require a base filter to specify the 
103 month of interest because the month is a non-aggregate output type. Now imagine 
104 that you wish to list all items with more than 25 holds. This would require an 
105 aggregate filter on the number of holds per item because you must use an 
106 aggregate output type to count the holds.
107