Reports for WinForms | ComponentOne
In This Topic
    Sorting Data
    In This Topic

    You can sort data in reports the following two ways:

    Group sorting is done using the DataView.Sort property, which takes a list of column names only (not expressions on column names). So if your grouping expression is DatePart("yyyy", dateColumn), the control will actually sort on the dates in the dateColumn field, not on the years of those dates as most would expect.

    To sort based on the dates, add a calculated column to the data table (by changing the SQL statement), and then group/sort on the calculated column instead. See the Sort property for an XML discussion of this, including a sample.

    This is what the Sorting and Grouping editor looks like in the C1ReportDesigner application. Note the fields where you can specify group sorting:

    If you use both approaches, the sorting set in the report groups will prevail (it is applied after the data has been retrieved from the database).

    Note: For the complete report, see report "19: Sorting" in the CommonTasks.xml report definition file, which is available in the ComponentOne Samples folder.