SortField Class
Represents a record or group sort field. This class provides properties to get and set information on sort fields in the report.
Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)
Syntax
'Declaration
Public Class SortField
Inherits EngineObjectBase
Implements IDisposable
public class SortField : EngineObjectBase, IDisposable
Remarks
Retrieve a SortField object by index through the Item Property of the SortFields collection.
Example
This example updates the sorted database field.
'Declaration
Private Sub UpdateSortField(ByVal myReportDocument As ReportDocument, ByVal tableName As String, ByVal fieldName As String)
Dim myDatabaseFieldDefinition As DatabaseFieldDefinition
myDatabaseFieldDefinition = myReportDocument.Database.Tables.Item(tableName).Fields.Item(fieldName)
Dim mySortField As SortField = myReportDocument.DataDefinition.SortFields.Item(1)
If (mySortField.SortType = SortFieldType.RecordSortField) Then
mySortField.Field = myDatabaseFieldDefinition
mySortField.SortDirection = SortDirection.AscendingOrder
End If
End Sub
private void UpdateSortField(ReportDocument reportDocument, String tableName, String fieldName)
{
DatabaseFieldDefinition databaseFieldDefinition;
databaseFieldDefinition = reportDocument.Database.Tables[tableName].Fields[fieldName];
SortField sortField = reportDocument.DataDefinition.SortFields[1];
if (sortField.SortType == SortFieldType.RecordSortField)
{
sortField.Field = databaseFieldDefinition;
sortField.SortDirection = SortDirection.AscendingOrder;
}
}
Inheritance Hierarchy
Object
EngineObjectBase
SortField
Version Information
Crystal Reports Basic for Visual Studio 2008
Supported since: Crystal Reports for Visual Studio .NET 2002
See Also
Reference
SortField Members
CrystalDecisions.CrystalReports.Engine Namespace