ComponentOne FlexReport for WinForms
Working with FlexReportDesigner / Working with Parameters / Cascading Parameters
In This Topic
    Cascading Parameters
    In This Topic

    Cascading parameters are used when a list of values in one parameter depends on the value selected for the other parameter. So you have two parameters, where one parameter alters the data source used to list data values for another parameter.

    For instance, if you want to select a Product from a list of products that belong to the selected Category, then you need to do the following:

    1. Create a new report. Bind the report to Order Details available in C1NWind.mdb.
    2. Add two Data Sources, one for each parameter:
      • dsCategory to pass values to parameter prmCategory
      • dsProduct to pass values to parameter prmProduct

    3. Right-click dsCategories and select Edit to edit the data source. Set Data provider, Connection string, and write following Sql Statement:

      select * from categories

    4. Repeat the previous step for dsProducts. Write the following Sql Statement:

      select * from products where categoryid = prmCategory

    5. Right-click Main data source, select Edit and write Sql Statement for Main data source:

      select * from [order details] where productid = prmProduct

    6. Add two parameters:
      • prmCategory to select Category.
      • prmProduct to select Product that belongs to the category selected in prmCategory parameter.
    7. Set the AllowedValuesDefinition property for both the parameters as shown:
      prmCategory prmProduct
      Data Source dsCategory dsProduct
      Label CategoryName ProductName
      Value CategoryID ProductID
    8. Click Preview.

    On selecting a category, a list of products available in that category are displayed in the other parameter. You can then select the product and then click Apply Parameters. Here, we have displayed data in Aniseed Syrup product that falls in the Condiments category.