Changes between Version 4 and Version 5 of TracTicketsCustomFields

Feb 26, 2008 5:40:00 PM (9 years ago)



  • TracTicketsCustomFields

    v4 v5  
    1717   * label: Descriptive label.
    1818   * 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.)
    2020 * '''checkbox''': A boolean value check box.
    2121   * label: Descriptive label.
    2525   * label: Descriptive label.
    2626   * options: List of values, separated by '''|''' (vertical pipe).
    27    * value: Default value (Item #, starting at 0).
     27   * value: Default value (one of the values from options).
    2828   * order: Sort order placement.
    2929 * '''radio''': Radio buttons. Essentially the same as '''select'''.
    5757test_four.label = My selectbox
    5858test_four.options = one|two|third option|four
    59 test_four.value = 2
     59test_four.value = two
    6161test_five = radio
    7575=== Reports Involving Custom Fields ===
    77 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.
     77Custom 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`.
    79 The following example includes a custom ticket field named `progress` in the report:
     81SELECT 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 = c.ticket AND = 'progress'
     85AND = t.priority AND p.type = 'priority'
     86  ORDER BY p.value
     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.
     90However, 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.