com.crystaldecisions.sdk.occa.report.application
Class SortController

java.lang.Object
  extended by com.crystaldecisions.sdk.occa.report.application.SortController

Deprecated. As of version 4.0. Replaced by RecordSortController and GroupSortController. To move or re-order group sorts, use the GroupController to move the groups.

@Deprecated
public class SortController
extends java.lang.Object

This object is used to modify the way in which data in the report is sorted. If a report contains groups, then a sort order can be applied to these groups as well as to the details within each group.

Note: When you add a group to the Groups collection, a group sort is automatically added to the Sorts collection. Group sorts should be in the same order as groups. To ensure that the order remains the same in both collections, add groups (and therefore group sorts) to the report before adding detail sorts.

The order of the Sort objects in the collection's array is important since it defines the order in which the fields will be sorted. The field in the Sort object in item(0) will be sorted first. For example, if you have two database fields displayed on a report--Country and Customer Name--as item(0) and item(1) respectively, then the information in the Country column will be sorted first, and the details in the Customer Name field will be sorted next. If Customer Name is moved to the first position, then this field is what the rowset is initially sorted on.

If a group contains a summary, it is possible for the group to be Top N sorted. In a Top N sort, groups are sorted according to the group summary that was inserted, and the data is grouped according to the group name for the first N groups. The groups that are not included in the Top N are either discarded or grouped under a specified name. For more details, see the TopNSort object.

Tip:


Method Summary
 int add(int index, ISort sort)
          Deprecated. As of version 4.0.
 boolean canSortOn(IField field)
          Deprecated. As of version 4.0.
 boolean canTopNSortOn(IField field)
          Deprecated. As of version 4.0.
 ISort findSort(IField field)
          Deprecated. As of version 4.0.
 void modify(int index, ISort newSort)
          Deprecated. As of version 4.0.
 void modify(ISort oldSort, ISort newSort)
          Deprecated. As of version 4.0.
 void modifySortDirection(int index, SortDirection direction)
          Deprecated. As of version 4.0.
 void modifySortDirection(ISort sort, SortDirection direction)
          Deprecated. As of version 4.0.
 void move(int nFrom, int nTo)
          Deprecated. As of version 4.0.
 void move(ISort sort, int nTo)
          Deprecated. As of version 4.0.
 void remove(int index)
          Deprecated. As of version 4.0.
 void remove(ISort sort)
          Deprecated. As of version 4.0.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

@Deprecated
public int add(int index,
                          ISort sort)
        throws ReportSDKException
Deprecated. As of version 4.0.

Adds a sort to the report. This method returns the index of the item in the collection after it has been added. A sort object is stored in the Sorts collection, which can be accessed through the getSorts() method in the DataDefinition object. The index is zero-based. The new Sort object is added to the end of the collection and will be sorted after all the other fields in the Sort objects have been sorted.

Before adding a sort to the report, use the canSortOn method to see if a particular field can be used to sort data.

Parameters:
index - The position in the array where you want to add the ISort object. Specify -1 to add the object to the end of the array.
sort - The sort that you want to add to the report.
Returns:
An int that specifies the index at which the ISort object was added.
Throws:
ReportSDKException

canSortOn

@Deprecated
public boolean canSortOn(IField field)
Deprecated. As of version 4.0.

Returns true if the field can be used to sort data, and false otherwise. Before adding a sort to the report, use this method to see if a particular field can be used to sort data. Only recurring fields can be sorted.

Parameters:
field - The field that you want to sort data on.
Returns:
true if the field can be used to sort data, and false otherwise.

canTopNSortOn

@Deprecated
public boolean canTopNSortOn(IField field)
Deprecated. As of version 4.0.

Returns true if the field can be used to do a Top N sort, and false otherwise. Only summary fields that are based on a group can be Top N sorted.

Use this method to check if the field that you want to sort data on is a summary field based on a group. For example, suppose that you have grouped your data by Country and summarized Last Year's Sales for each group. This function will return true if you pass in the summary field as the argument.

Parameters:
field - The field that you want to sort data on.
Returns:
true if the field can be used to do a Top N sort, and false otherwise.

findSort

@Deprecated
public ISort findSort(IField field)
               throws ReportSDKException
Deprecated. As of version 4.0.

Retrieves a sort given a particular field. If the field has not been sorted on, null is returned.

Parameters:
field - The field that has (or has not) been used to sort on.
Returns:
An ISort object corresponding to the given field.
Throws:
ReportSDKException

modify

@Deprecated
public void modify(int index,
                              ISort newSort)
            throws ReportSDKException
Deprecated. As of version 4.0.

Modifies a sort. The collection of Sort objects can be accessed by using the getSorts method in the DataDefinition object. The index is zero-based.

Parameters:
index - The index of the sort to be modified in the collection.
newSort - The new Sort object.
Throws:
ReportSDKException

modify

@Deprecated
public void modify(ISort oldSort,
                              ISort newSort)
            throws ReportSDKException
Deprecated. As of version 4.0.

Modifies a sort. The collection of Sort objects can be accessed by using the getSorts method in the DataDefinition object. The index is zero-based.

Parameters:
oldSort - The Sort object to be modified in the collection.
newSort - The new Sort object.
Throws:
ReportSDKException

move

@Deprecated
public void move(int nFrom,
                            int nTo)
          throws ReportSDKException
Deprecated. As of version 4.0.

Moves a Sort object from one position in the array to another. The collection of Sort objects can be accessed by using the getSorts method in the DataDefinition object. The index is zero-based. The order of the Sort objects in the collection's array is important since it defines the order in which the fields will be sorted. The Sort object in item(0) will be sorted first.

Parameters:
nFrom - The index of the Sort object to be moved in the collection.
nTo - The new index position of the Sort object.
Throws:
ReportSDKException

move

@Deprecated
public void move(ISort sort,
                            int nTo)
          throws ReportSDKException
Deprecated. As of version 4.0.

Moves a Sort object from one position in the array to another. The collection of Sort objects can be accessed by using the getSorts method in the DataDefinition object. The index is zero-based. The order of the Sort objects in the collection's array is important since it defines the order in which the fields will be sorted. The Sort object in item(0) will be sorted first.

Parameters:
sort - The Sort object to be moved in the collection.
nTo - The new index position of the Sort object.
Throws:
ReportSDKException

remove

@Deprecated
public void remove(int index)
            throws ReportSDKException
Deprecated. As of version 4.0.

Removes a sort from the collection. The collection of Sort objects can be accessed by using the getSorts method in the DataDefinition object. The index is zero-based.

Parameters:
index - The index of the Sort object to be removed from the collection.
Throws:
ReportSDKException

remove

@Deprecated
public void remove(ISort sort)
            throws ReportSDKException
Deprecated. As of version 4.0.

Removes a sort from the collection. The collection of Sort objects can be accessed by using the getSorts method in the DataDefinition object. The index is zero-based.

Parameters:
sort - The Sort object to be removed from the collection.
Throws:
ReportSDKException

modifySortDirection

@Deprecated
public void modifySortDirection(int index,
                                           SortDirection direction)
                         throws ReportSDKException
Deprecated. As of version 4.0.

Modifies the direction of a sort found by sort index.

The sort direction can be changed from the existing sort direction to any one of ascending order, descending order, only sorting the bottom N items, only sorting the top N items, sorting the bottom N percentage, or the top N percentage as defined by SortDirection

Example:

This sample shows how to modify how data in the report is sorted. The sort direction can be changed from the existing sort direction to any one of the following options as defined in the CrSortDirectionEnum enumeration: ascending order, descending order, sorting only the bottom N items, sorting only the top N items.

 DataDefController dataDefController = clientDoc.getDataDefController();
 SortController sortController = dataDefController.getSortController();
 sortController.modifySortDirection( 0, SortDirection.ascendingOrder );
 

Parameters:
index - the index of the sort whose direction you will modify. The sort index which is the Item property of the Sorts collection.
direction - the new direction of the sort as defined by SortDirection.
Throws:
ReportSDKException

modifySortDirection

@Deprecated
public void modifySortDirection(ISort sort,
                                           SortDirection direction)
                         throws ReportSDKException
Deprecated. As of version 4.0.

Modifies the direction of a sort by sort index.

The sort direction can be changed from the existing sort direction to any one of ascending order, descending order, only sorting the bottom N items, only sorting the top N items, sorting the bottom N percentage, or the top N percentage as defined by SortDirection

Parameters:
sort - the ISort object whose direction you will modify
direction - the new direction of the sort as defined by SortDirection.
Throws:
ReportSDKException