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

GroupOptions KeepTogether property

Declaration

property KeepTogether: TCrBoolean

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

The KeepTogether property encapsulates the functionality of the "Keep Group Together" option which is available when a Group is created or modified in the Seagate Crystal Reports designer. When set to cTrue, it prevents a Group from splitting on Page Break (if possible).

Example

This example shows how to set the RepeatGH and KeepTogether properties:

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

for cnt := 0 to (Crpe1.GroupOptions.Count - 1) do begin

Crpe1.GroupOptions[cnt].RepeatGH := cTrue; Crpe1.GroupOptions[cnt].KeepTogether := cTrue;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

GroupOptions Number property

Declaration

property Number: TCrGroupOptionsNumber;

Type

TCrGroupOptionsNumber = integer;

VCL Reference

371

Description

The Number property specifies the Group Number. Unlike most of the other properties, Number is one-based, therefore the first Group is number one (1). This was done to be consistent with the Section naming convention wherein the first Group Header is GH1, etc. The GroupOptions object, however, is still zero-based, thus the first item in GroupOptions is still GroupOptions[0].

Number is a key property, and therefore serves as a lookup; that is, assigning it a value will cause the GroupOptions object to point to the item that has a Group Number with the same value.

Before using the Number property to navigate through the GroupOptions, the Retrieve method should be called, or the manual Add method.

Example

This example retrieves the GroupOptions values from the Report, and uses the Number property to set the first Group to the {company.STATE} field:

Crpe1.ReportName := 'C:\Company.rpt'; {Retrieve the GroupOptions from the Report} Crpe1.GroupOptions.Retrieve;

{Set the GroupOptions object to Group Number 1} Crpe1.GroupOptions.Number := 1;

{Assign the values for Group Number 1} Crpe1.GroupOptions.Field := '{company.STATE}'; Crpe1.GroupOptions.Condition := AnyChange; Crpe1.GroupOptions.Direction := gcAscending; Crpe1.Output := toWindow;

Crpe1.Execute;

GroupOptions RepeatGH property

Declaration

property RepeatGH: TCrBoolean

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

RepeatGH determines whether the Group Header will repeat on each new page of the Report when the grouped records are split over more than one page.

VCL Reference

372

Example

This example shows how to set the RepeatGH and KeepTogether properties:

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

for cnt := 0 to (Crpe1.GroupOptions.Count - 1) do begin

Crpe1.GroupOptions[cnt].RepeatGH := cTrue; Crpe1.GroupOptions[cnt].KeepTogether := cTrue;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

GroupOptions TopNDiscardOthers property

Declaration

property TopNDiscardOthers: TCrBoolean

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

The TopNDiscardOthers property determines if the TopN grouping will put all other Groups that are outside of the TopN/BottomN selection in a Group called "Others", or if they will be discarded. If TopNDiscardOthers is set to cTrue, the other Groups will be discarded.

Example

This example shows how to use the TopN features of GroupOptions. In this case, the top 10 groups (based on the summary of their Sales) will be shown on the Report. All other groups will be discarded. The TopN selection will take place on the outer Group (Group number 1):

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.GroupOptions.Retrieve; Crpe1.GroupOptions[0].TopNOptions := tnTopN; Crpe1.GroupOptions[0].TopNGroups := 10; Crpe1.GroupOptions[0].TopNSortField := 'Sum({company.SALES},{company.STATE})'; Crpe1.GroupOptions[0].TopNDiscardOthers := cTrue; Crpe1.Output := toWindow;

Crpe1.Execute;

VCL Reference

373

GroupOptions TopNGroups property

Declaration

property TopNGroups: smallint

Description

TopNGroups specifies how many groups will be included in the TopN/BottomN selection. The TopNOptions property must be set to either tnTopN or tnBottomN for this property to have any effect.

Example

This example shows how to use the TopN features of GroupOptions. In this case, the top 10 groups (based on the summary of their Sales) will be shown on the Report. All other groups will be discarded. The TopN selection will take place on the outer Group (Group number 1):

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.GroupOptions.Retrieve; Crpe1.GroupOptions[0].TopNOptions := tnTopN; Crpe1.GroupOptions[0].TopNGroups := 10; Crpe1.GroupOptions[0].TopNSortField := 'Sum({company.SALES},{company.STATE})'; Crpe1.GroupOptions[0].TopNDiscardOthers := cTrue; Crpe1.Output := toWindow;

Crpe1.Execute;

GroupOptions TopNOptions property

Declaration

property TopNOptions: TCrTopNOptions

Type

TCrTopNOptions = (tnUnsorted, tnSorted, tnTopN, tnBottomN, tnDefault);

VCL Reference

374

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