Using the Report Designer

Reports

under construction

You can use the Report Designer to edit existing reports, as well as create your own reports from scratch. This topic describes the most basic tasks you may encounter when editing a report in the Report Designer.

See also:


Saving reports

To guarantee that you will be able to revert your report to its original state, you need to create a backup copy. Then, you can apply changes without worrying that it will be hard to restore your report in case something's broken.

To save a copy of your report, select File | Save, click the save toolbar button, or press CTRL+S. In this case, the report will be saved in the application's current folder. The path to your report will be displayed in the Report Designer's title bar.

Changing element layout in your report

You can freely move report elements, e.g. labels, by dragging them. Another way to change the element position is to select an element, and then press the arrow keys.

Dragging

To resize an element, select it and then drag one of the small boxes shown on its edges and corners. To resize an element using keyboard shortcuts, press SHIFT+ARROW or CTRL+SHIFT+ARROW.

Resizing

You can also easily align controls to each other or make them the same size, buy selecting multiple controls and using the Layout Toolbar.

Align Tops

To select multiple controls, you can do one of the following.

For information on how to work with tables, see the Report controls topic.

Adding or modifying static information in your report

Reports display static and dynamic information. Dynamic information is something that changes through a report - values from a database (actual report data) or service information (such as current user name or page numbers). Static information is text or images that doesn't change through the report, and doesn't depend on the current computer. Such information can be printed only once (e.g. in a report header), can repeat on each page (e.g. in a page header) or can repeat with every entry in your report (a label describing your data).

To change static information

If you need to change static information displayed by your report, simply locate the desired report element in the designer and invoke this element's smart tag. The smart tag will contain a link or a button allowing you to edit this element's content.

Text elements, such as labels and rich text boxes, also allow in-place editing of their content. Simply double-click an element and activate the editor. If you're working with rich text, you can use Formatting Toolbar.

To add information to your report

To add information to your report, you need to use an appropriate element from the Control Toolbox, such as a Label, Rich Text Box or Picture Box. Once an element has been placed at the appropriate position, specify its content using the smart tag. For instance, the following instructions describe how to add a rich text box into your report.

  1. Drop the Rich Text control from the Toolbox onto the Detail band.

  2. Select the created control and click its Smart Tag. In the invoked actions list, click the Load File link.

  3. In the dialog, define the path to an RTF or TXT file containing the text of the announcement, and click Open.

You can perform additional text formatting using the Formatting Toolbar.

Deleting report elements

To delete a report element (band or control), do one of the following:

You can cancel the operation by pressing CTRL+Z.

Displaying values from a database (binding report elements to data)

Report elements can either display static information or dynamic data fetched from the bound database. Data-bound elements are indicated in the Report Designer using a little database icon in the top-right corner.

Sometimes you may work with a report that is missing some information. For instance, you may have an employee list that doesn't display birth dates. If the database contains this information, you can easily add it to your report using one of the methods described below.

To use the Field List

To use the Smart Tab

Click an element's Smart Tag, and in the invoked menu, expand the Data Binding drop-down list and select the required data field.

To use the Property Grid

Click an element to show it's properties in the Property Grid. Expand the (Data Bindings) branch that holds the bindable attributes. Specify a data field for the required attribute (e.g. Text).

Changing value formatting of report elements

  1. To change value formatting, locate the required element, click its smart tag, and then click the ellipsis button next to Format String.

Format String

  1. This will invoke the Format String Editor dialog, allowing you to choose one of the predefined formatting styles.

Format String Editor Dialog

  1. Select the required style and click OK, to close the dialog and save the changes.

Changing fonts and colors of report elements

To change fonts and colors (as well as paddings, text alignment and other appearance properties) of a report control or band, select this element and do one of the following:

Font Colors Formatting Toolbar

Fonts Colors Property Grid

Changing or applying data sorting to a report

Use this procedure to sort a report's data. In this example, we use a report containing a Label control bound to a CategoryID data field. This field will be used as a sorting criteria.

  1. Click the Detail band's Smart Tag, and in the invoked menu, click the Sort Fields ellipsis button.

  2. In the dialog, click Add, to add a new entry, and set the FieldName property to a data field against which you want to sort your data. You can also define a sorting order (ascending or descending).

Sort Data

You can sort data against multiple data fields. For this purpose, add more entries and specify their data field and sort order settings.

  1. To apply the settings and close the dialog, click OK. The report is now ready. Switch to the Preview Tab, and view the result.

Changing or applying data filtering to a report

To filter a report's data, select the report, and in the Property Grid, click the Filter String ellipsis button. The FilterString Editor will appear, allowing you to easily define a required expression.

Filter Data

The report is now ready. Switch to the Preview Tab, and view the result.

It is also possible to request a filtering parameter each time a report is previewed. See Add Parameters to a Report for details.

Changing or applying data grouping to a report

This procedure demonstrates how to group a report's data. Note that data grouping can be performed only if a report is bound to a data source.

To group records in a report, follow the instructions below.

  1. Add a Group Header band to the report.

For this, right-click anywhere over the report's surface, and in the invoked Context Menu, select Insert Band | GroupHeader.

  1. Drop a field, which will be used as a grouping criteria, from the Field List onto the created GroupHeader1 band.

Group Data

  1. Drop a field, representing the general report's data onto the report's Detail band.

Group Data

  1. Click the Smart Tag of the GroupHeader1 band, and in the invoked actions list, click the ellipsis button in the Group Fields section. The GroupField Collection Editor dialog will appear.

Group Data

  1. In this dialog, click Add, to add a new grouping field, and set its Field Name property to the required field.

Also, you can define whether the sort order for this grouping field should be ascending or descending, by using the Sort Order property.

  1. To apply the settings and close the dialog, click OK.

  2. Again, click the GroupHeader1 band's Smart Tag, and in the Group Union drop-down list, select Whole Page, so that a report group starts on a new page if it doesn't fit entirely on the previous one.

Group Data

  1. The report is now ready. Switch to the Preview Tab, and view the result.

Adding totals to a report

To calculate summaries (totals) within a report, follow the instructions below.

  1. If the Report Footer band is not present in your report, add it. To do this, right-click anywhere over the report's area and in the invoked Context Menu, select Insert Band | Report Footer.

  2. Click the field for which a summary will be calculated, to select it. Then, hold down CTRL and drag the field onto the Report Footer area, to create an exact copy of the Label that will display the summary.

Calculate Summary

You can also create a new label for your total by simply dragging it from the Control Toolbox.

  1. Select the newly created Label, and in the Property Grid, click the Summary ellipsis button. The Summary Editor will appear.

The following image shows an example of how you can set up your total. Note that the Summary Running option is set to Report, to ensure that all values from the specified data field are taken into account.

Caclulate Summary

The Ignore NULL values option won't affect the result in this example, since NULL values are treated like zeros, by default. So, Sum won't change whether these values are taken into account or not. This option makes sense for functions like Count or Average, because the number of elements counted will depend on it.

  1. To save the settings and close the dialog, click OK.

  2. Switch to the Preview Tab, and view the result.

Creating or modifying watermarks of a report

This procedure describes how to add a text watermark to a report, or turn a picture into a report's background. Note that watermarks are visible only in Preview and HTML View modes.

Follow the instructions below to create a new watermark in a report (or to modify the existing watermark, if it is already present in a report).

  1. To select the report, click anywhere over the blank surface surrounding its bands area.

  2. Then, in the Property Grid, click Watermark ellipsis button. The Watermark dialog will appear.

Add Watermark

Add Watermark

As you can see, it is possible to use both textual and image watermarks simultaneously.

Add Watermark

  1. The report with watermark is now ready. Switch to the Preview Tab, and view the result.

Adding page numbers and system information to a report

This procedure describes how to insert page numbers or other system information (e.g. current date and time, user name, etc.) into a report.

Generally, this information is displayed within the Page Header and Footer or Page Margin bands. To add page numbers or system information to a report, locate the Control Toolbox and drag and drop the Page Info control.

Insert System Information

Follow the instructions below for your specific task:

To add page numbers

  1. Select the Page Info control, then in the Property Grid select the Page Information drop-down list. You can select whether to display only the page number (Latin or Roman - uppercase or lowercase) or the current page number of total pages.

  2. Define a formatting to the control's text. In the Property Grid, set the Format property to Page {0} of {1}.

To add system date and time

  1. Select the Page Info control, then in the Property Grid select the Page Information drop-down list. Select Current Date and Time.

  2. Also, you can define a formatting to the control's text, using its Format property.

To add the user name

  1. Select the Page Info control, then in the Property Grid select the Page Information drop-down list. Select User Name.

  2. Define a formatting to the control's text. In the Property Grid, set the Format property to Current User: {0}.

Adding calculated fields to a report

This procedure demonstrates how to add a calculated field to a report. The main purpose of calculated fields is to perform calculations over different data fields. To learn how to easily perform calculations within a single data field, refer to Adding totals to a report.

To add a calculated field to your report, follow the instructions below.

  1. To create a calculated field, in the Field List, right-click any item, and choose Add Calculated Field.

Calculate Field

  1. In the Field List, select the created field to show its properties in the Property Grid. Change the Field Type property to an appropriate value.

Calculate Field

  1. Create an expression for the calculated field.

  1. Click the ellipsis button in the Expression section. The Expression Editor will appear. You can also invoke this dialog by right-clicking your calculated field within the Field List and selecting Edit Expression...

Create Expression

  1. Click Fields to see the field list. Double-click field names to add them to the expression string. Use the toolbar to add operators between field names.

  2. To close the dialog and save the expression, click OK.

  1. Drag the calculated field from the Field List onto a control or a table cell.

Calculate Field

  1. The report with a calculated field is now ready. Switch to the Preview Tab, and view the result.

Adding parameters to a report

Sometimes it's useful have parameters in your report. Parameters can help you filter your data or specify a value that will be used to calculate other values (in the latter case, use calculated fields).

To add parameters and filter your report based on their values, follow the steps below.

  1. In the Field List window, right-click over the Parameters section, and click Add Parameter. Repeat this action to create the second parameter.

  2. In the Field List, select the first parameter, and in the Property Grid, set its (Name) to FromDate, Description to From: and Parameter Type to Date Time. For the second parameter, set these properties as shown in the following image.

Add Parameters

You have now created two report parameters. Every time you preview your report, you will be asked to enter their values. The following instructions explain how to use these values to filter your report's data.

  1. Select the report (by clicking anywhere over the blank space in the report designer), and in the Property Grid, click the Filter String ellipsis button. The FilterString Editor will appear. In this dialog, define the required expressions involving the created parameters.

Add Paramter

  1. Make sure that the report's Request Parameters property is set to Yes, as it is by default. Otherwise, the parameters won't be requested during the preview, and as a result, you'll get a blank report.

  2. The parameterized report is now ready. Switch to the Preview Tab, and in the Parameters section, define the required values and click Submit.