[]
        
(Showing Draft Content)

Create Parameterized Report

Wyn Enterprise allows you to use parameters to filter or add the data to display in reports at run time. You can either prompt users for parameters so that they control the output, or supply the parameters behind the scenes.

What You Will Learn

This tutorial guides you through the steps to create a parameterized report in Wyn Enterprise Report Designer.

Note: This tutorial uses sample SalesByRegion data set.

After you complete this tutorial, you will have a report that looks similar to the following.


Parameterized Report Example


(Parameter1 = Canada West and Parameter2 = 1004)

Create Databound Table

To create a databound table,

  1. Go to the Data tab and click the drop-down next to the SalesByRegion data set. You can now see all the available fields in the data set.

  2. Enable Select Fields... and then choose the desired fields required in the table.

    Enable Select Fields option

  3. Drag-drop the selected fields onto the design area. A table with its column bound to the fields is created. You can see the Header row and Details row of the table are automatically filled with the data.

    Enable Select Fields option

    Alternatively, you can first drag-drop the Table data region Table Data Region onto the design area of the report and then populate the data by dragging and dropping the fields onto the details row.

Note: The Data Set Name property of the table is automatically set to SalesByRegion.

Add Parameter to the Report

Let us add two parameters that would act as filters for data retrieved from the data source, one would be passed as a filter for the region, and the other to filter the data according to store ids.


Properties for both Parameters - 1 and 2


To add a report parameter that filters the data according to the region,

  1. From the top right corner of Report Designer, click the Data icon Data Icon.

  2. Click Add next to Parameters. A parameter named Parameter1 is added.

  3. Click Parameter1 to edit parameter properties.

  4. Set Data Type property to String and Prompt property to 'Enter Region'.

    Setting properties for Parameter 1

  5. Under the Available Values section, select the Source . In this example, we have selected the source as From Query and set the following properties as shown below.

    Properties for Parameter 1


    You can sort the parameter values using the Order By property. By default, the OrderBy property is set to None. The Order By dropdown list has the following options as shown below.


    Order By

    • None: When this option is selected, then the parameter values are sorted in the order determined by a data set query.

    • Label: When this option is selected, then the parameter values are ordered according to Label Field specified above.

    • Value: When this option is selected, then the parameter values are ordered according to Value Field specified above.

    Sort Direction Sort Direction Icon( Ascending / Descending) toggle button: You can use this toggle button to add the sort direction for Label Field / Value Field.

Note: Values in the parameter dropdown in the viewer will be sorted based on the value field set in the OrderBy property and the Sort Direction.

To add a parameter that filters the data according to the store id,

  1. From the top right corner of Report Designer, click the Data icon Data Icon.

  2. Click Add next to Parameters. A parameter named Parameter2 is added.

  3. Click Parameter2 to edit parameter properties.

  4. Set Data Type property to Integer and Prompt property to 'Enter Store ID'.

    Setting Properties for Parameter 2

  5. Under the Available Values section, select the Source as From Query and set the following properties as shown below.

    Properties for Parameter 2

    You can sort the parameter values using the Order By property as explained above in step 5.

Manage Data in the Report

To control the amount of data rendered in the report, we can add filters to the Table data region. In our report, we will be adding two filters such that the report renders data according to the user input in the parameters (Parameter1 and Parameter2).


Filter Property displaying two filters in the report

  1. Select the table and go to Properties pane.

  2. In the Filters property, click + Add to specify the filter conditions.

  3. Select the All Of, that is the AND, logical operator.

  4. Click the + Add to display the fields and then select the Region field.

  5. Set the corresponding filter value for the Region field to 'Parameter1'.

    Filter Property

  6. In the same way, set 'Parameter2' as the filter value for the StoreID field. The Filters property should now look like the following.

    Filter Property

Add Page Header

  1. Go to the Report tab on top of the designer and select Add Header option.

    Add Page Header

  2. Drag and drop a TextBox control Textbox Control in the page header area.

  3. Click inside the text box and enter the text 'Sales Order Report'.

Customize the Appearance of Parameterized Report

Customize Appearance of Parameterized Report Example

Note: You may need to resize and reposition the controls on the report to accommodate data, and for a cleaner look.

  1. Set the BACKGROUND - Color property for the page header and header row of the table to '#f1f1f1'.

  2. Align the text in the textboxes using the TEXT - Text Align (Left, Right, Center, and Justify.) and TEXT - Vertical Text Align (Top, Middle, or Bottom) properties. By default, these properties are set to General and Top.

  3. Set the font size for the text in the page header to 14pt using the TEXT - Font Size property.

  4. Specify the border properties for the textboxes in the table using the BORDER - Width, Border - Style, and BORDER - Color properties. Set the border values to '0.25pt', 'Solid', and '#f1f1f1', respectively.

  5. Change the TEXT - Format property for the Profit field to 'Currency'. This property displays the profit values in currency format.

Preview and Save Report

  1. Click Preview to view your report in the final output. You will be prompted to enter two parameters - select the region name and the store id for which you want to view the report, and again click Preview.

    Note: The values in the Parameter list appear as sorted based on the value selected from the Order By property and the Sort Direction( Ascending/Descending) as specified under the Available Values section on the From Query Source, while editing the Parameters.

  2. Exit the preview mode by clicking Back on the left side of the designer.

  3. Click Save to open the Save dialog box. Enter the report name as 'Detail Report' and click Save Report.