Defining default parameter values

You can define default parameter values in a report by using static text, report expressions, or data items with references to corresponding queries. Multiple values and ranges can be defined for each parameter.

Alternatively, for certain prompt controls, you can use the preexisting Default selections property to provide static selections. However, applying default values for parameters is more powerful and flexible, and allows to provide dynamic default values. If both Default values and Default selections are defined for a prompt control, the default values override the default selections. For more information, see Specify a Default Selection for a Prompt.

Procedure

  1. From the Report menu in the toolbar, click Parameters.
  2. On the Default values tab, perform one of the following steps:
    • If you want to create a new parameter and then specify its default values, click the plus icon Add value, or drag the parameter type from the Insertable objects pane to the Default values tab. Then, continue with the rest of the steps. For information about the parameter types, see Creating and managing parameters.
    • If the parameter already exists, and you want to define or edit its default value, go to step 4.
  3. Type the parameter name, such as pPL or pDate, and click OK.

    The parameter name appears in the Parameters box.

  4. Click the parameter name.
  5. In the Default Values box, click the plus icon to specify the default value for the selected parameter.
  6. Select Value to specify a single value, or Range value to specify a range of values.

    The minimum and maximum values in the Range value can be based on expressions.

    For both selections, in the Default value dialog box, select one of the following options for the Source type:

    • Text

      Use to specify static values. For example, in the following image, the default value is based on a text source.

    • Report expression

      Opens the expression editor where you can specify the expression by using standard Cognos® Analytics functions. Macros can also be used. For example, in the following image, the default value is based on a report expression.

    • Data item value

      This option is available only if a query is selected first. For example, in the following image, the default value is based on a data item.

    Note: For default parameter values to work with prompt controls, ensure that both objects use the same type of value, either Value or Range value. If you specify both range and single default values for a parameter, one of these types of values might be ignored by certain prompt controls. For example, the single value is ignored in prompt controls that have a range value enabled, and the range value is ignored in prompt controls that have a single value enabled.

    For all types of values, you can specify the Display value. This value is displayed to the report user instead of the value used in the authoring environment. The display value, just like the default value itself, can be based on a static text, report expression, or data item. The source of the default value and display value can be different. For example, you can set a static display value based on Text for a default value based on Report expression.