Skip to content

ParameterCount - cDRReport

Methods - Properties - Events

Method Type

Function

Return Type

Integer

Arguments

Argument Description
sReportID ID of the report. Can be ID of the main report or the ID of a sub-report. This argument can be passed as an empty string. The empty string can be written as C_USEMAINDRREPORTID.

Description

Returns the number of parameters for a (sub)report which uses a stored procedure as the data source or a report that defines user parameters. You can test if the report is based on a stored procedure with ReportUsesStoredProcedures.

If the report does not contain parameters, the return value is zero.

An error will be generated when this message is sent and the report is not opened.

This method cannot be used before the report OCX object is initialized. The COM object creation is performed as part of the OpenReport method if not done beforehand.

DataFlex Framework Usage

  • Web
  • Windows
  • FlexTron

Sample

Object oReport is a cDRReport
    Set psReportName to 'MyReport.dr'
    Set peOutputDestination to PRINT_TO_PRINTER
End_Object

Object oRunReportButton is a Button
    Set Label to 'Run Report'

    Procedure OnClick
        Integer iParameters iParameter
        String sReportId sName sValue

        Get OpenReport of oReport to sReportId
        If (sReportId <> '') Begin
            Get ParameterCount of oReport sReportId to iParameters
            Decrement iParameters
            For iParameter from 0 to iParameters
                // Show name and current value of the parameter
                Get ParameterName of oReport sReportId iParameter to sName
                Get psParameterValue of oReport sReportId iParameter to sValue
                Get AcceptParameter of oParameterDialog sName sValue to sValue
                Set psParameterValue of oReport sReportId iParameter to sValue
            Loop
            Send OutputReport of oReport
            Send CloseReport of oReport sReportId
        End
    End_Procedure
End_Object