Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

OfficeWriter and Reporting Services allow you to use parameters to filter the data returned by your database query, and display a subset of the data in your report.

What is a parameter?

A parameter is a value that filters data. For example, you have a sales report that lists each sales group and each sales rep within that group. However, you only want to see one sales group at a time. If you use the sales group field as a parameter, when the report is executed, you will be prompted to select a group. The report will only display data for the group that you selected.

A single report can include multiple parameters.
To use parameters, you must first define them. Defining parameters differs depending on whether you set them up in OfficeWriter Designer or in Visual Studio. We will explore both so you can determine which is best for you.

...

This will cover how to define parameters in a report using MS Query in the OfficeWriter Designer.

For more on parameters in OfficeWriter repots, please refer to 8.1 - Excel Reports with Parameters

OfficeWriter uses Microsoft Query to add parameters to a report.

...

Let's add a parameter to a sample query. The sample will use the AdventureWorks2000 AdventureWorks sample database, which ships with Reporting Services.

  1. Open Microsoft Excel.
    # Click Add QueryDataSet on the OfficeWriter toolbar.
    # Follow steps 2-11 of Create a Database Query.
    # In the Add Tables dialog box, find the SalesOrderHeader table in the list and select Add. Click Close.
    # In Microsoft Query, drag the following fields to the query: SalesOrderID, SalesPersonID, and TotalDue.
    !xlw_parameter1.jpg!
    # Click the Hide/Show Criteria button on the Microsoft Query toolbar to open the criteria table.
    !xlw_parameter2.jpg!
    # Click within the top left cell in the criteria table and select * SalesPersonID* from the drop-down list.
    # In Value cell beneath SalesPersonID, type [Enter the Sales Person ID]. This is the text that will be used to prompt the user.
    !xlw_parameter3.jpg!
    # Microsoft Query will prompt you to enter the default value for the parameter. Enter a sales person ID value.
    !xlw_parameter4.jpg!
    # From the File menu, select *Return to OfficeWriter Designer*.
    # Using OfficeWriter Designer's Insert Field button, add the fields to your report.
    # Publish the report.
    # Click View on the OfficeWriter toolbar. You will be asked to enter a parameter value.
    !xlw_parameter5.jpg!
    # Replace the 0 with 280. Every row displayed in the report will have SalesPersonID number 280.
    !xlw_parameter6.jpg!

...