<< Click to Display Table of Contents >>

 

This tutorial illustrates how to group a report against a custom criteria, in particular, group data by days of the week.

1.Create a new or open an existing data-bound report.

You cannot apply grouping unless your report is bound to a data source.

2.Create a calculated field. Switch to the Field List, right-click any item inside the data source and select Add Calculated Field.

eurd-win-group-data-create-calculated-field

3.Select the calculated field, and in the Property Grid, click the Expression property's ellipsis button.

eurd-win-group-data-calculated-field-properties

4.In the invoked Expression Editor, select the required date-time function and define the data field's name in [square brackets]. For example, use the GetDayOfWeek([OrderDate]) function to return a zero-based index of the day of the week, extracted from the OrderDate data field.

eurd-win-group-data-calculated-field-expression

Click OK to close the editor and save the changes.

5.Use the Group and Sort panel to quickly create a Group Header band associated with the calculated field.

To create a group criteria, click Add a Group and select the calculated field from the invoked drop-down menu.

eurd-win-group-by-calculated-field

You can also use this panel to specify whether or not the corresponding Group Footer band should be visible. The Sort Order drop-down list allows you to define the sort order within the group (ascending or descending) or disable sorting in grouped data.

6.Switch to the Field List and drop the required data fields onto the report's area.

eurd-win-group-by-field-layout

7.Click the smart tag of the label in the Group Header and set the Format String property to {0:dddd}. This makes the label only display the day of the week, and not the date.

eurd-win-group-by-field-format-string

Switch to Print Preview to see the result.

eurd-win-group-by-calculated-field-result