Previous Topic: Customizing Time Display in Date ParametersNext Topic: Customizing Results for Display or Download


Customizing the date_range Parameter

The collection of specified and pre-defined periods provided by default with the date_range parameter type are adequate for most purposes, but if required, the list of options can be customized.

To customize the date_range periods, simply specify option elements within the date_range parameter for each period required. The type attribute is used to select either the 'specified' or 'predefined' range. If no type is specified, the default is pre-defined.

The default specified or pre-defined period label can be overridden by specifying the required text in the <option> element as shown in pre-defined options 1 and 6 below. Specified options 1 and 2, and pre-defined options 3, 4, 5 and 11, will use the default text.

In addition, user-defined periods can be specified using a negative option value, the value being the length of the period. For example, -42 gives a range of six weeks. All user-defined periods begin the specified number of days ago and end today; there is no facility to specify the end of the period.

Example user-defined periods

<parameter name="dates" type="date_range" argpos="1" label=" Dates:" attrs="2;5;1;-21">
    <option type="specified" value="1"/>
    <option type="specified" value="2"/>
    <option type="specified" value="-14">Fortnights</option>
    <option type="predefined" value="1">Every date possible</option>
    <option value="-2">Two Days</option>
    <option value="3"/>
    <option value="4"/>
    <option value="-10">Ten Days</option>
    <option value="-21">Three Weeks</option>
    <option value="5"/>
    <option value="6">A month ago</option>
    <option value="-42">Six Weeks</option>
    <option value="11"/>
</parameter>

The example on the previous page will produce this list of specified periods:

And this list of pre-defined periods: