[[PageOutline(2-5,Contents,pullout)]] = Default and convert report dynamic variables to dropdowns {{{#!box warn **Notice:** This plugin is deprecated in Trac 1.3.2 and later, which provides equivalent features: * Dynamic variables are autocompleted //(Since 1.3.2)// ([trac:#12230]) * Default values for dynamic variables can be defined in SQL comments //(Since 1.3.1)// ([trac:#11837]) }}} == Description This plugin applies to all [TracReports#AdvancedReports:DynamicVariables reports that use dynamic variables]. The plugin does the following for dynamic variables whose (uppercase) name exactly matches a built-in or custom (lowercase) ''select'' field name: * Dynamic variables are set to default values if unset. * The text fields for dynamic variables are converted to dropdown lists. !JavaScript is required for the latter feature. The only required configuration is in defining SQL reports. For example, a report for a specific {{{milestone}}} that also queries for a custom {{{queue}}} select field could be defined like this: {{{#!sql SELECT p.value AS __color__, t.id AS ticket, summary, component, severity, reporter FROM ticket t LEFT OUTER JOIN milestone m ON t.milestone = m.name LEFT JOIN enum p ON p.name = t.severity AND p.type = 'severity' LEFT OUTER JOIN ticket_custom q ON q.ticket = t.id AND q.name = 'queue' WHERE q.value = '$QUEUE' AND milestone = '$MILESTONE' ORDER BY m.due ASC, p.value }}} The result is as follows: === Before [[Image(before.png)]] === After [[Image(after.png)]] Completed milestones are omitted from the dropdown menu. == Bugs/Feature Requests Existing bugs and feature requests for DynamicVariablesPlugin are [report:9?COMPONENT=DynamicVariablesPlugin here]. If you have any issues, create a [/newticket?component=DynamicVariablesPlugin new ticket]. [[TicketQuery(component=DynamicVariablesPlugin&group=type,format=progress)]] == Download Download the zipped source from [export:dynamicvariablesplugin here]. == Source You can check out DynamicVariablesPlugin from [/svn/dynamicvariablesplugin here] using Subversion, or [source:dynamicvariablesplugin browse the source] with Trac. == Installation and Configuration 1. See [t:TracPlugins TracPlugins] for installation details and options. Enable the plugin through the //Plugins// admin page, or in your `trac.ini` file: {{{#!ini [components] dynvars.* = enabled }}} 1. (Optional) Set a {{{[dynvars]}}} section of field names with explicit option values: {{{#!ini [dynvars] daysback.options = 7|30 }}} In the above example, {{{daysback}}} is not a custom ticket field, but can set a {{{DAYSBACK}}} dynamic variable via a dropdown list with the specified options. A {{{[dynvars]}}} section is not needed to configure dynamic variables that exactly match built-in or custom field names as shown in the screenshots below. 1. Create/modify reports so that the names used for dynamic variables match the names of the select field that it corresponds to. == Recent Changes [[ChangeLog(dynamicvariablesplugin, 3)]] == Author/Contributors '''Author:''' [wiki:robguttman] [[BR]] '''Maintainer:''' [[Maintainer]] [[BR]] '''Contributors:'''