|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.crystaldecisions.sdk.occa.report.application.RecordSortController
public class RecordSortController
This class is used to modify how records are sorted in a report. Reports that contain groups also
have group-level sorting, which can be modified using the GroupSortController.
Record sorts can be found in the Sorts collection returned by
DataDefinition.getRecordSorts().
The order of the objects in the Sorts collection represents the order that they are
applied to the report data. If the report has groups, group-level sorting is applied before any
record sorting.
For example, if there are two ISort objects in the record sorts collection, where the
ISort at index 0 is on a database field named "Country" and the ISort at
index 1 is on a database field named "Customer Name", the report will be sorted first by "Country"
and then by "Customer Name". If the order of the two ISort objects is reversed, then
the report will be sorted by "Customer Name" and then "Country".
To access the RecordSortController, use the
getRecordSortController method in the
DataDefController object.
Note: To display a field on a report, add it to the ResultFields
collection. For more information about the ResultFields collection, see the ResultFieldController
class description.
Note: The GroupSortController and RecordSortController classes replace the
SortController class from previous releases.
GroupSortController| Method Summary | |
|---|---|
int |
add(int index,
ISort sort)
Adds a record sort to the report. |
static boolean |
canSortOn(IField field)
Returns true if the field can be used to sort data, and false otherwise. |
ISort |
findSort(IField field)
Retrieves a sort given a particular field. |
void |
modify(int index,
ISort newSort)
Modifies a sort. |
void |
modify(ISort oldSort,
ISort newSort)
Modifies a sort. |
void |
modifySortDirection(int index,
SortDirection direction)
Modifies the direction of a sort found by sort index. |
void |
modifySortDirection(ISort sort,
SortDirection direction)
Modifies the direction of a sort by sort index. |
void |
move(int nFrom,
int nTo)
Moves a Sort object from one position in the array to another. |
void |
move(ISort sort,
int nTo)
Moves a Sort object from one position in the array to another. |
void |
remove(int index)
Removes a sort from the collection. |
void |
remove(ISort sort)
Removes a sort from the collection. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public int add(int index,
ISort sort)
throws ReportSDKException
Adds a record sort to the report. This method adds a sort object to the Sorts collection and returns the index of the sort after it has been added. This index is zero-based.
To add the Sort to the end of the Sorts collection, set the index parameter to -1. This causes the sort to be calculated after the other sorts have been calculated.
Before adding a sort to the report, use the canSortOn method to ensure that
the field can be used to sort data.
The Sorts collection can be accessed through
the getRecordSorts method in the
DataDefinition object.
index - the position in the Sorts collection to add the ISort object,
or -1 to add the object to the end of the collectionsort - the sort to add to the report
ReportSDKExceptionpublic static boolean canSortOn(IField field)
Returns true if the field can be used to sort data, and false otherwise.
Before adding a record 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.
field - the field to sort on
true if the field can be used to sort data, and false otherwise.
public ISort findSort(IField field)
throws ReportSDKException
Retrieves a sort given a particular field. If the field has not been sorted on, null
is returned.
field - The field that has (or has not) been used to sort on.
ISort object corresponding to the given field.
ReportSDKException
public void modify(int index,
ISort newSort)
throws ReportSDKException
Modifies a sort. The collection of Sort objects can be accessed by using the
getRecordSorts method
in the DataDefinition object. The index is zero-based.
index - The index of the sort to be modified in the collection.newSort - The new Sort object.
ReportSDKException
public void modify(ISort oldSort,
ISort newSort)
throws ReportSDKException
Modifies a sort. The collection of Sort objects can be accessed by using the
getRecordSorts
method in the DataDefinition object. The index is zero-based.
oldSort - The Sort object to be modified in the collection.newSort - The new Sort object.
ReportSDKException
public void move(int nFrom,
int nTo)
throws ReportSDKException
Moves a Sort object from one position in the array to another.
The collection of Sort objects can be accessed by using the getRecordSorts
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 at position 0 in the array
will be sorted first.
nFrom - The index of the Sort object to be moved in the collection.nTo - The new index position of the Sort object.
ReportSDKException
public void move(ISort sort,
int nTo)
throws ReportSDKException
Moves a Sort object from one position in the array to another.
The collection of Sort objects can be accessed by using the getRecordSorts
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 at position 0 in the array
will be sorted first.
sort - The Sort object to be moved in the collection.nTo - The new index position of the Sort object.
ReportSDKException
public void remove(int index)
throws ReportSDKException
Removes a sort from the collection. The collection of Sort objects can be
accessed by using the getRecordSorts
method in the DataDefinition object. The index is zero-based.
index - The index of the Sort object to be removed from the collection.
ReportSDKException
public void remove(ISort sort)
throws ReportSDKException
Removes a sort from the collection. The collection of Sort objects can be
accessed by using the getRecordSorts
method in the DataDefinition object. The index is zero-based.
sort - The Sort object to be removed from the collection.
ReportSDKException
public void modifySortDirection(int index,
SortDirection direction)
throws ReportSDKException
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
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.
ReportSDKException
public void modifySortDirection(ISort sort,
SortDirection direction)
throws ReportSDKException
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
sort - the ISort object whose direction you will modifydirection - the new direction of the sort as defined by SortDirection.
ReportSDKException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||