GroupSortFields
GroupSortFields specifies the group field(s) that are to be used to sort your data when the report is printed.
Syntax
[form.]Report.GroupSortFields(ArrayIndex)
[= "+|-GroupField"]
Enter the group field(s) on which you want your report to be sorted.
For example, assume that you have broken your data into state groups and had Crystal Reports count the number of customers in each group. In order to print the group with the highest count first, then the group with the next highest count, etc. (descending order), enter a string similar to the following:
CrystalReport1.GroupSortFields(0) = "-Count
({customer.CUSTOMER ID},{customer.REGION})"
Remarks
- GroupSortFields is an array property available at runtime only.
- Use a separate line of code to specify each group sort field.
- Enter group sort fields in the order that you want them to sort your report. For example, if you want your report to be sorted first on group sort field A and then on group sort field B, specify group sort field A in your first line of code and group sort field B in your second line of code.
- The first group sort field you specify must be assigned array index 0, the second group sort field must be assigned array index 1, etc.
- The index values you assign must be continuous; no gaps are allowed (0, 1, 2 = OK, 0, 1, 3 = wrong).
- Array index values must be subscripted in the code immediately after the property name (i.e., CrystalReport1.GroupSortFields(0) =).
- If you have specified sort fields for your report at Design Time, any sort fields you enter here will replace the sort fields in your report.
- If you do not use this property, the program will use the sorting instructions that you specified in the report.
- If you want to clear the group sort fields in your report, use an empty string (i.e., CrystalReport1.GroupSortFields(0) = "").
- This property is cleared once the print job is printed. If you print a second time, the program reverts to the group sort fields as originally specified in the report.
Note:
- The group sort field entry must follow the sort direction sign (+ or -) with no intervening space.
- To find the correct syntax for any group in your report using Crystal Reports for Visual Basic:
- choose the Formula Field command from the Insert menu,
- enter any formula name in the Insert Formula dialog box when it appears,
- click the scroll button on the Fields list in the Formula Editor when it appears, and
- double-click the group field of interest.
- Crystal Reports enters the group field name in the Formula text box. Use the name and syntax from that text box when constructing your group sort field string.
Data Type
Array of strings
Availability
Runtime
Related Report Engine Functions
PESetNthAlertConditionFormula