Adobe ColdFusion 8

Using input parameters to pass variables and other data at run time

Input parameters are data fields that you pass to the report at run time. You can place input parameters directly on a report band or you can use them as input to a calculated field.

Define input parameters in the same manner as query fields. You can specify a default value that ColdFusion uses when there is no corresponding parameter. For more information on defining input parameters, see Defining, modifying, and using fields and input parameters.

You use input parameters in the following ways:

  • Through the cfreportparam tag: Input parameters must correspond, by name, to cfreportparam tags embedded in the CFM page invocation. For example, if you define an input parameter named ReportTime, you pass a cfreportparam tag with a name attribute set to ReportTime, as the following example shows:
    <cfreport format="PDF" template="FourthReport.cfr" query="#coursedept#">
        <cfreportparam name="ReportTime" value="#DateFormat(Now())#, #TimeFormat(Now())#">
    </cfreport>
    

  • Subreport parameters: When a subreport requires information from a main report, you define subreport parameters in the main report and corresponding input parameters in the subreport. For more information, see Using subreports.

For information on dynamically populating input parameters at run time, see Advanced query mode.