|
- Timestamp:
-
Apr 28, 2008, 2:20:40 PM (17 years ago)
- Author:
-
trac
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v1
|
v2
|
|
17 | 17 | * label: Descriptive label. |
18 | 18 | * value: Default value. |
19 | | * order: Sort order placement. (Determines relative placement in forms.) |
| 19 | * order: Sort order placement. (Determines relative placement in forms with respect to other custom fields.) |
20 | 20 | * '''checkbox''': A boolean value check box. |
21 | 21 | * label: Descriptive label. |
… |
… |
|
23 | 23 | * order: Sort order placement. |
24 | 24 | * '''select''': Drop-down select box. Uses a list of values. |
| 25 | * label: Descriptive label. |
25 | 26 | * options: List of values, separated by '''|''' (vertical pipe). |
26 | | * value: Default value (Item #, starting at 0). |
| 27 | * value: Default value (one of the values from options). |
27 | 28 | * order: Sort order placement. |
28 | 29 | * '''radio''': Radio buttons. Essentially the same as '''select'''. |
… |
… |
|
56 | 57 | test_four.label = My selectbox |
57 | 58 | test_four.options = one|two|third option|four |
58 | | test_four.value = 2 |
| 59 | test_four.value = two |
59 | 60 | |
60 | 61 | test_five = radio |
… |
… |
|
70 | 71 | }}} |
71 | 72 | |
72 | | ''Note: To make an entering an option for a `select` type field optional, specify a leading `|` in the `fieldname.options` option.'' |
| 73 | ''Note: To make entering an option for a `select` type field optional, specify a leading `|` in the `fieldname.options` option.'' |
73 | 74 | |
74 | 75 | === Reports Involving Custom Fields === |
75 | 76 | |
76 | | The SQL required for TracReports to include custom ticket fields is relatively hard to get right. You need a `JOIN` with the `ticket_custom` field for every custom field that should be involved. |
| 77 | Custom ticket fields are stored in the `ticket_custom` table, not in the `ticket` table. So to display the values from custom fields in a report, you will need a join on the 2 tables. Let's use an example with a custom ticket field called `progress`. |
77 | 78 | |
78 | | The following example includes a custom ticket field named `progress` in the report: |
| 79 | {{{ |
| 80 | #!sql |
| 81 | SELECT p.value AS __color__, |
| 82 | id AS ticket, summary, owner, c.value AS progress |
| 83 | FROM ticket t, enum p, ticket_custom c |
| 84 | WHERE status IN ('assigned') AND t.id = c.ticket AND c.name = 'progress' |
| 85 | AND p.name = t.priority AND p.type = 'priority' |
| 86 | ORDER BY p.value |
| 87 | }}} |
| 88 | '''Note''' that this will only show tickets that have progress set in them, which is '''not the same as showing all tickets'''. If you created this custom ticket field ''after'' you have already created some tickets, they will not have that field defined, and thus they will never show up on this ticket query. If you go back and modify those tickets, the field will be defined, and they will appear in the query. If that's all you want, you're set. |
| 89 | |
| 90 | However, if you want to show all ticket entries (with progress defined and without), you need to use a `JOIN` for every custom field that is in the query. |
79 | 91 | {{{ |
80 | 92 | #!sql |
|