DateFieldPlugin: Sample_Report.txt

File Sample_Report.txt, 0.7 kB (added by bigjonroberts, 1 year ago)

Example of using date field in a report.

Line 
1 Author: Jon Roberts
2 Date Created: 2008-02-01
3
4 I thought it would be useful to have an example of using a date field in custom reports.
5
6 This is for the following configuration in trac.ini:
7
8 [ticket-custom]
9 due_date = text
10 due_date.date = true
11 due_date.date_empty = true
12 due_date.label = Date Due (mm-dd-yyyy)
13
14 [datefield]
15 format = mdy
16 separator = /
17
18
19
20
21 Here is the report SQL:
22
23 SELECT p.value AS __color__,
24    id AS ticket, summary, owner, c.value AS due_date
25   FROM ticket t, enum p, ticket_custom c
26   WHERE t.id = c.ticket AND c.name = 'due_date'
27 AND p.name = t.priority AND p.type = 'priority'
28   ORDER BY date(substr(c.value,7,4)||"-"||substr(c.value,1,2)||"-"||substr(c.value,4,2)),p.value