Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
163
Добавлен:
11.05.2015
Размер:
4.73 Mб
Скачать

GroupOptions

Declaration

property GroupOptions : TCrpeGroupOptions;

Type

TCrpeGroupOptions = class(TPersistent)

Description

GroupOptions contains all the properties that relate to Grouping, including TopN control.

The Number property specifies the Group Number. Groups are numbered from 1 up, so the first Group in a Report is 1.

The Condition property setting determines when a new group will be formed. For Groups based on Date and Boolean fields, there are specific values that can be assigned. For all other Groups, "AnyChange" is the only condition that is applicable.

The Direction property determines in what order the Groups will be sorted: gdAscending, gdDescending, gdOriginal, gdSpecified, or gdDefault.

The Field property contains the actual Grouping field, which can be a Database field or a Formula field.

The GroupType property specifies the data type of the field or formula that the Group is based on: gtOther, gtDate, or gtBoolean.

The KeepTogether property specifies whether the Group will be split over two pages or not when it will not all fit at the bottom of a page.

The RepeatGH property specifies whether the Group Header will be repeated on the top of the next page when a Group is split over two pages.

The Retrieve method will fetch the GroupOptions values from the Report and fill the GroupOptions object with corresponding items.

The Count method returns the number of GroupOptions items currently contained in the GroupOptions object.

The Item and ItemIndex methods can be used to navigate through the GroupOptions object.

The Clear method removes all items from the GroupOptions object.

The Add and Delete methods provide a manual alternative to Retrieve/Clear for adding and deleting items from the GroupOptions object.

There are four properties that apply specifically to TopN Group selection. TopN refers to the selecting and ordering of Groups. The sorting part is also available via the GroupSortFields object, but the selecting part is not. This can be used to show only a specified number of Groups, i.e. the Top 5 based on a certain summary field.

VCL Reference

41

The TopNGroups property specifies the number of Groups to select.

The TopNSortField property specifies the summary field that the Groups will be ordered by.

The TopNDiscardOthers property specifies whether the Groups that are out of the N range will be discarded or whether they will be included in a Group called "Others".

The TopNOptions property specifies how the TopN properties will be applied. The options are: tnUnsorted, tnSorted, tnTopN, tnBottomN, and tnDefault.

NOTE: GroupOptions is new as of Crystal Reports 6.0, and is therefore not available to Crystal 5.0 users (they will have to use GroupCondition instead). GroupCondition can still be used with Crystal 6.0 if desired, but it is not as powerful as GroupOptions (it lacks the TopN control, etc.). Also, GroupCondition and GroupOptions should not be used together, since they both cover the same ground.

GroupOptions Example

This sample retrieves the GroupOptions values from the Report, and sets the first Group to the {company.STATE} field, ascending:

Crpe1.ReportName := 'C:\Company.rpt'; with Crpe1.GroupOptions do

begin

Retrieve; Number := 1;

Field := '{company.STATE}'; Condition := AnyChange; Direction := gcAscending;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

GroupOptions Properties

GroupOptions Condition property, Page 365

GroupOptions Direction property, Page 367

GroupOptions Field property, Page 368

GroupOptions GroupType property, Page 368

GroupOptions Item property, Page 369

GroupOptions ItemIndex property, Page 370

GroupOptions KeepTogether property, Page 371

GroupOptions Number property, Page 371

GroupOptions RepeatGH property, Page 372

GroupOptions TopNDiscardOthers property, Page 373

VCL Reference

42

Соседние файлы в папке crystal