Changes between Version 8 and Version 9 of TracReports
- Timestamp:
- 11/04/19 11:01:01 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracReports
v8 v9 111 111 }}} 112 112 113 Dynamic variables can also be used in the report title and description (since 1.1.1). 114 113 115 == Advanced Reports: Dynamic Variables 114 116 115 117 For more flexible reports, Trac supports the use of ''dynamic variables'' in report SQL statements. 116 In short, dynamic variables are ''special'' strings that are replaced by custom data before query execution. 118 In short, dynamic variables are ''special'' strings that are replaced by custom data before query execution. Dynamic variables are entered through the preferences form and the values are autocompleted //(Since 1.3.2)//. 117 119 118 120 === Using Variables in a Query 119 121 120 The syntax for dynamic variables is simple, any upper case word beginning with '$'is considered a variable.122 The syntax for dynamic variables is simple, any upper case word beginning with `$` is considered a variable. 121 123 122 124 Example: … … 125 127 }}} 126 128 127 To assign a value to $PRIORITY when viewing the report, you must define it as an argument in the report URL, leaving out the leading '$': 129 The value of the dynamic variable can be assigned in the report preferences form. 130 131 To assign a value to `$PRIORITY` in the URL for a report, leave out the leading `$`: 128 132 {{{ 129 133 http://trac.edgewall.org/reports/14?PRIORITY=high 130 134 }}} 131 135 132 To use multiple variables, separate them with an '&':136 To use multiple variables, separate them with an `&`: 133 137 {{{ 134 138 http://trac.edgewall.org/reports/14?PRIORITY=high&SEVERITY=critical 135 139 }}} 140 141 It is possible to assign a default value to the variable, within a SQL comment: 142 143 {{{#!sql 144 -- PRIORITY = high 145 146 SELECT id AS ticket,summary FROM ticket WHERE priority=$PRIORITY 147 }}} 148 136 149 137 150 === !Special/Constant Variables