1 <?xml version="1.0" encoding="utf-8"?>
\r
2 <chapter xml:id="template-terminology" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="EN"
\r
3 xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink">
\r
5 <title>Template Terminology</title>
\r
8 <simplesect xml:id="create-template-datatypes">
\r
10 <title>Data Types</title>
\r
12 <informalfigure> <para>The central column of the <guilabel>Database Source Browser</guilabel> lists
\r
13 <guilabel>Field Name</guilabel> and <guilabel>Data Type</guilabel> for the
\r
14 selected database table. </para>
\r
17 <imagedata scalefit="0" fileref="../media/create-template-33.png"/>
\r
19 </mediaobject></para>
\r
21 <para>Each data type has its own characteristics and uses:</para>
\r
23 <tgroup cols="3" align="left" colsep="1" rowsep="1">
\r
24 <colspec colnum="1" colname="type" colwidth="1.0*"/>
\r
25 <colspec colnum="2" colname="description" colwidth="1.0*"/>
\r
26 <colspec colnum="3" colname="notes" colwidth="2.0*"/>
\r
29 <entry>Data Type</entry>
\r
30 <entry>Description</entry>
\r
31 <entry>Notes</entry>
\r
37 <entry>Unique number assigned by the database to identify a
\r
39 <entry>A number that is a meaningful reference for the database but not of much use to a human user. Use in <guilabel>displayed fields</guilabel> when counting
\r
40 records or in filters.</entry>
\r
44 <entry>Text field</entry>
\r
45 <entry>Usually uses the <guilabel>Raw Data</guilabel> transform.</entry>
\r
48 <entry>timestamp</entry>
\r
49 <entry>Exact date and time</entry>
\r
50 <entry>Select appropriate date/time transform. <guilabel>Raw
\r
51 Data</guilabel> includes second and timezone information, usually more than is required for a report.</entry>
\r
55 <entry>True or False</entry>
\r
56 <entry>Commonly used to filter out deleted item or patron records.</entry>
\r
59 <entry>org_unit</entry>
\r
60 <entry>A number representing a library, library system, or
\r
62 <entry>When you want to filter on a library, make sure that the field
\r
63 name is on an <guilabel>org_unit</guilabel> or <guilabel>id</guilabel> data type.</entry>
\r
67 <entry>A link to another database table</entry>
\r
68 <entry><guilabel>Link</guilabel> outputs a number that is a meaningful
\r
69 reference for the database but not of much use to a human user. You
\r
70 will usually want to drill further down the tree in the
\r
71 <guilabel>Sources</guilabel> pane and select fields from the
\r
72 linked table. However, in some instances you might
\r
73 want to use a <guilabel>link</guilabel> field. For example, to count the number of patrons who borrowed items you could do
\r
74 a count on the <guilabel>Patron</guilabel> <guilabel>link</guilabel> data.</entry>
\r
78 <entry>Integer</entry>
\r
82 <entry>money</entry>
\r
83 <entry>Number (in dollars)</entry>
\r
90 <simplesect xml:id="create-template-transforms">
\r
92 <title>Field Transforms</title>
\r
94 <informalfigure> <para>A <guilabel>Field Transform</guilabel> tells the reporter how to process a field
\r
95 for output. Different data types have different transform options. </para>
\r
96 <para> <mediaobject>
\r
98 <imagedata scalefit="0" fileref="../media/create-template-34.png"/>
\r
100 </mediaobject></para></informalfigure>
\r
103 <formalpara><title>Raw Data</title><para> To display a field exactly as it appears in
\r
104 the database use the <guilabel>Raw Data</guilabel> transform, available for all data
\r
105 types.</para></formalpara>
\r
107 <formalpara><title><guilabel>Count</guilabel> and <guilabel>Count Distinct</guilabel></title><para> These transforms
\r
108 apply to the <guilabel>id</guilabel> data type and are used to count database
\r
109 records (e.g. for circulation statistics). Use <guimenuitem>Count</guimenuitem> to
\r
110 tally the total number of records. Use <guilabel>Count Distinct</guilabel> to count
\r
111 the number of unique records, removing duplicates. </para></formalpara>
\r
112 <para>To demonstrate the difference between <guilabel>Count</guilabel> and
\r
113 <guilabel>Count Distinct</guilabel>, consider an example where you want to know
\r
114 the number of active patrons in a given month, where <emphasis>active</emphasis>
\r
115 means they borrowed at least one item. Each circulation is linked to a Patron ID, a
\r
116 number identifying the patron who borrowed the item. If we use the <guilabel>Count
\r
117 Distinct</guilabel> transform for Patron IDs we will know the number of unique
\r
118 patrons who circulated at least one book (2 patrons in the table below). If instead,
\r
119 we use <guilabel>Count</guilabel>, we will know how many books were circulated,
\r
120 since every circulation is linked to a patron ID and duplicate values are also
\r
121 counted. To identify the number of active patrons in this example the
\r
122 <guilabel>Count Distinct</guilabel> transform should be used.</para>
\r
126 <tgroup cols="3" align="left" colsep="1" rowsep="1">
\r
127 <colspec colnum="1" colname="title" colwidth="2.0*"/>
\r
128 <colspec colnum="2" colname="id" colwidth="1.0*"/>
\r
129 <colspec colnum="3" colname="name" colwidth="1.0*"/>
\r
133 <entry>Title</entry>
\r
134 <entry> Patron ID</entry>
\r
135 <entry> Patron Name</entry>
\r
140 <entry> Harry Potter and the Chamber of Secrets</entry>
\r
141 <entry> 001</entry>
\r
142 <entry> John Doe</entry>
\r
146 <entry> Northern Lights</entry>
\r
147 <entry> 001</entry>
\r
148 <entry> John Doe</entry>
\r
151 <entry> Harry Potter and the Philosopher’s Stone</entry>
\r
152 <entry> 222</entry>
\r
153 <entry> Jane Doe</entry>
\r
160 <formalpara><title>Output Type</title><para> Note that each transform has either an <guilabel>Aggregate</guilabel> or
\r
161 <guilabel>Non-Aggregate</guilabel> output type. </para></formalpara>
\r
163 <para> <mediaobject>
\r
165 <imagedata scalefit="0" fileref="../media/create-template-35.png"/>
\r
167 </mediaobject></para>
\r
169 <para> Selecting a <guilabel>Non-Aggregate</guilabel> output type will return one row of
\r
170 output in your report for each row in the database. Selecting an
\r
171 <guilabel>Aggregate</guilabel> output type will group together several rows of
\r
172 the database and return just one row of output with, say, the average value or the
\r
173 total count for that group. Other common aggregate types include minimum, maximum,
\r
175 <para>When used as filters, non-aggregate and aggregate types correspond to <guilabel>Base</guilabel> and <guilabel>Aggregate</guilabel> filters respectively. To see the difference between a base filter and an aggregate filter, imagine that
\r
176 you are creating a report to count the number of circulations in January. This would
\r
177 require a base filter to specify the month of interest because the month is a
\r
178 non-aggregate output type. Now imagine that you wish to list all items with more
\r
179 than 25 holds. This would require an aggregate filter on the number of holds per
\r
180 item because you must use an aggregate output type to count the holds.</para>
\r