The drop-down parameter allows a report consumer to choose a single option.




In addition to the to the common attributes available to all parameter types the following additional attributes are available:



  • Is Value Required
    • Defines whether a user must choose an option before executing the report.  Click here to read more about the "Is Value Required" attribute.
  • Publish Updates
    • The publish updates option is used to broadcast selected options to other parameters with a report, primarily used for cascading dropdowns.  Click here to learn more about defining cascading dropdowns.
  • Datasource Query
    • TIP: Pressing the F-11 key the cursor is in the Datasource Query textbox will enlarge the editor area, press F-11 again to return to the default view. 
    • Specifies the values that will be shown in the drop down list.  Two methods are available to specify the items
      • SQL Query: Use a SQL query and only return (2) columns, Id and Name.  The Id will be used as the value passed to the report query and Name will be used as the display text shown to the user.  You can also also return an optional "IsSelected" column to specify value should be selected by default.
      • Static List: You can also specify parameters statically by supplying a comma seperated list of key value pairs as in the following example:
        • Using the format of: Name:Id
        • This is the first option : 1, This is the second option : 2, This is the third option : 3
        • Example shown below:

  • Default Value
    • Enter an Id value returned from the Datasource Query to set the dropdown to a default value


The above static data source renders the options to the report consumer:


 

Usage in SQL Command Text

A single variable will be declared as VARCHAR(MAX) in the auto-generated section and can be used as a standard SQL variable.  In the below example a dropdown parameter with a programmatic name of "BookFormatTypeId" has been added to the report and is utilized within the SQL to search for books with the specified book format type.



 

The generated SQL when executing a report containing a dropdown parameter type is shown below:



One more parameter is also provided so that results can be altered based on the state of the report as shown below.


  • FirstTimeload
    • First time the report is loaded, prior to the report being executed
  • RefreshParameters
    • Control is refreshing due to cascading
  • Execute
    • Control is loading after report has been executed


Parent-Child Reports

If the control is hosted on a child report parameters will also be available from the parent in the same manner the child report query itself. Click here to learn more about parent-child report variables.