Changes between Version 4 and Version 5 of TracReports


Ignore:
Timestamp:
Apr 6, 2020, 3:35:21 AM (4 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracReports

    v4 v5  
    111111}}}
    112112
     113Dynamic variables can also be used in the report title and description (since 1.1.1).
     114
    113115== Advanced Reports: Dynamic Variables
    114116
    115117For 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.
     118In 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)//.
    117119
    118120=== Using Variables in a Query
    119121
    120 The syntax for dynamic variables is simple, any upper case word beginning with '$' is considered a variable.
     122The syntax for dynamic variables is simple, any upper case word beginning with `$` is considered a variable.
    121123
    122124Example:
     
    125127}}}
    126128
    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 '$':
     129The value of the dynamic variable can be assigned in the report preferences form.
     130
     131To assign a value to `$PRIORITY` in the URL for a report, leave out the leading `$`:
    128132{{{
    129133 http://trac.edgewall.org/reports/14?PRIORITY=high
    130134}}}
    131135
    132 To use multiple variables, separate them with an '&':
     136To use multiple variables, separate them with an `&`:
    133137{{{
    134138 http://trac.edgewall.org/reports/14?PRIORITY=high&SEVERITY=critical
    135139}}}
     140
     141It is possible to assign a default value to the variable, within a SQL comment:
     142
     143{{{#!sql
     144-- PRIORITY = high
     145
     146SELECT id AS ticket,summary FROM ticket WHERE priority=$PRIORITY
     147}}}
     148
    136149
    137150=== !Special/Constant Variables