3 package OpenILS::WWW::Reporter;
5 our $dtype_xform_map = {
6 'int' => [ 'avg','stddev','sum','count','count_dist','numformat'],
7 'numeric' => [ 'avg','stddev','sum','count','count_dist','numformat'],
8 'float' => [ 'avg','stddev','sum','count','count_dist','numformat'],
9 'time' => [ 'count', 'dateformat'],
10 'date' => [ 'count', 'age','dateformat'],
11 'timestamp' => [ 'count', 'age','dateformat'],
12 'timestamptz' => [ 'count', 'age','dateformat'],
13 'text' => [ 'count','count_dist','lower','upper','substr','dewy','dewy_prefix'],
20 'name' => 'Average per group',
21 'select' => 'AVG(?COLNAME?)',
24 'label' => 'Standard Deviation per group',
25 'select' => 'STDDEV(?COLNAME?)',
28 'label' => 'Sum per group',
29 'select' => 'SUM(?COLNAME?)',
32 'label' => 'Count per group',
33 'select' => 'COUNT(?COLNAME?)',
36 'label' => 'Distinct Count per group',
37 'select' => 'COUNT(DISTINCT ?COLNAME?)',
40 'label' => 'Extract Dewey number prefix from call number',
41 'select' => 'call_number_dewey(?COLNAME?,?PARAM?)',
45 'label' => 'Extract Dewey number from call number',
46 'select' => 'call_number_dewey(?COLNAME?)',
49 'label' => 'Transform string to lower case',
50 'select' => 'LOWER(?COLNAME?)',
53 'label' => 'Transform string to upper case',
54 'select' => 'UPPER(?COLNAME?)',
57 'label' => 'Trim string length',
58 'select' => 'substr(?COLNAME?,1,?PARAM?)',
62 'label' => 'Age as of runtime -- day granularity',
63 'select' => 'AGE(?COLNAME?::DATE)',
65 'dateformat' => { # see http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html
66 'label' => 'Format date and time',
67 'select' => "TO_CHAR(?COLNAME?,'?PARAM?')",
70 'numformat' => { # see http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html
71 'label' => 'Format Numeric data',
72 'select' => "TO_CHAR(?COLNAME?,'?PARAM?')",