Share via


TopBottomNSortField Class

Allows you to get and set options for the TopN and BottomN sort field.

Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

Syntax

'Declaration
Public Class TopBottomNSortField
    Inherits SortField
    Implements IDisposable
public class TopBottomNSortField : SortField, IDisposable

Remarks

Retrieve a SortField object by index through the Item Property of the SortFields collection and cast the SortField object as a TopBottomNSortField object.

Example

This example returns a TopBottomNSortField object and sets the properties of the TopBottomNSortField.

'Declaration

      Private Function GetTopBottomNSortField _
         (ByVal sortFieldIndex As Integer) As TopBottomNSortField

         Dim topBottomNSortField As TopBottomNSortField

         If TypeOf _
         (Report.DataDefinition.SortFields.Item(sortFieldIndex)) _
            Is TopBottomNSortField Then
            topBottomNSortField = _
               Report.DataDefinition.SortFields.Item(sortFieldIndex)
            GetTopBottomNSortField = topBottomNSortField
         Else : GetTopBottomNSortField = Nothing
         End If
      End Function

            Private Sub SetTopBottomNSortFieldOptions(ByVal TopBottomNSortField As TopBottomNSortField, _
              ByVal enableDiscardOtherGroups As Boolean, ByVal field As FieldDefinition)
               TopBottomNSortField.EnableDiscardOtherGroups = enableDiscardOtherGroups
               TopBottomNSortField.Field = field
               TopBottomNSortField.NotInTopBottomNName = ""
               TopBottomNSortField.NumberOfTopOrBottomNGroups = 1
               TopBottomNSortField.SortDirection = SortDirection.AscendingOrder
      End Sub
      
      private TopBottomNSortField GetTopBottomNSortField
         (int sortFieldIndex)
      {
         TopBottomNSortField topBottomNSortField;

         topBottomNSortField =
            Report.DataDefinition.SortFields[sortFieldIndex]
            as TopBottomNSortField;
         if (topBottomNSortField != null) return topBottomNSortField;
         else return null;
      }

            private void SetTopBottomNSortFieldOptions(TopBottomNSortField topBottomNSortField,
              bool enableDiscardOtherGroups, FieldDefinition field)
           {
               topBottomNSortField.EnableDiscardOtherGroups = enableDiscardOtherGroups;
               topBottomNSortField.Field = field;
               topBottomNSortField.NotInTopBottomNName = "";
               topBottomNSortField.NumberOfTopOrBottomNGroups = 1;
               topBottomNSortField.SortDirection = SortDirection.AscendingOrder;
      }
      

Inheritance Hierarchy

Object
   EngineObjectBase
      SortField
         TopBottomNSortField

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

TopBottomNSortField Members
CrystalDecisions.CrystalReports.Engine Namespace