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

Example

The following example copies all the GroupCondition property values to a temporary TCrpeGroupCondition object:

var

tempGroupCondition : TCrpeGroupCondition; begin

tempGroupCondition := TCrpeGroupCondition.Create; tempGroupCondition.CopyFrom(Crpe1.GroupCondition); {...later, when finished with the temp object...} tempGroupCondition.Free;

end;

GroupCondition Count method

Declaration

function Count: integer;

Description

The Count method can be used to obtain the number of items currently in the GroupCondition object. It is handy for setting up loops to make similar changes to each item.

Example

The Count method is useful for looping constructions. You would normally want to call Retrieve first:

var

cnt: integer; begin

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

for cnt := 0 to (Crpe1.GroupCondition.Count - 1) do Crpe1.GroupCondition[cnt].Direction := gcAscending;

end;

GroupCondition Create method

Declaration

constructor Create;

VCL Reference

362

Description

The Create method is used internally in the Crystal component to create the GroupCondition object, and does not need to be called in code.

GroupCondition Delete method

Declaration

procedure Delete(nIndex: integer);

Description

The Delete method can be used to remove an item from the GroupCondition object. The "nIndex" parameter represents the number of the item in the GroupCondition object, not the Group number. Group numbers start with 1, whereas the first item in the GroupCondition object is item zero (0).

NOTE: Delete will not remove the GroupCondition from the Report, it will just remove it from the Crystal VCL.

Example

The Delete method can be used to manually remove an item from the GroupCondition object:

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

{Specify Group Number - must be same as in Report} Crpe1.GroupCondition.Add(1); Crpe1.GroupCondition.Field := '{company.STATE}'; Crpe1.Output := toWindow;

Crpe1.Execute;

{Delete an item. Note that although the Group Number specified was 1, the item to delete is item 0 of the GroupCondition object} Crpe1.GroupCondition.Delete(0);

GroupCondition Destroy method

Declaration

destructor Destroy; override;

Description

The Destroy method is used internally in the Crystal component and does not need to be called in code.

VCL Reference

363

GroupCondition Retrieve method

Declaration

function Retrieve: boolean;

Description

The Retrieve method obtains the GroupCondition information from the Report and stores it in the GroupCondition object. If no GroupCondition information was found, the call returns False. Be aware that calling Retrieve will first cause the GroupCondition object to be cleared, so any current information stored in it will be removed.

NOTE: Since the GroupCondition object also applies to Subreports, the Retrieve method will obtain the GroupCondition for the Report (or Subreport) that the Subreports object index is currently pointing to. If you want to obtain the GroupCondition information for the main Report and all of the Subreports, you will have to step through the Subreports object and call Retrieve for each item. The VCL will store separate GroupCondition information for each Subreport (see Example).

Example

The following code illustrates the use of the Retrieve method for the main Report:

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

Crpe1.GroupCondition.Retrieve;

The following code illustrates the use of the Retrieve method for the main Report and any Subreports:

var

cnt: integer; begin

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

{Loop through Reports and Retrieve}

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

Crpe1.Subreports[cnt];

Crpe1.GroupCondition.Retrieve; end;

{Set Crpe component back to main Report} Crpe1.Subreports[0];

end;

VCL Reference

364

GroupCondition Send method

Declaration

function Send: boolean;

Description

The Send method sends the GroupCondition values to the Crystal Reports Print Engine. This method is called automatically when the Execute method is called, provided that SendOnExecute is set to True.

It is strongly recommended that you leave SendOnExecute to True, and let the Crystal Reports component send the values to the Print Engine. If you set the SendOnExecute property to False, each Sub-class and each property that does not belong to a Sub-class must be manually sent before calling the Execute method. This feature is mainly provided for debugging purposes.

Example

In this example, the GroupCondition settings are sent from the Crystal component to the Crystal Reports Print Engine DLL. This is normally handled automatically in the Execute method:

Crpe1.GroupCondition.Send;

GroupOptions Properties

GroupOptions Condition property

Declaration

property Condition : TCrGroupCondition

Type

TCrGroupCondition = (AnyChange, dateDaily, dateWeekly, dateBiWeekly, dateSemiMonthly, dateMonthly, dateQuarterly, dateSemiAnnually, dateAnnually, boolToYes, boolToNo, boolEveryYes, boolEveryNo, boolNextIsYes, boolNextIsNo);

Description

The Condition property determines when a new Group is begun. Groups based on Date and Boolean fields are the only ones that have specific Condition values. All other types of fields use AnyChange as the Group Condition value.

VCL Reference

365

For Groups based on Date fields, the options are:

Condition

Description

 

 

 

 

dateDaily

Triggers a grouping for every Day.

dateWeekly

Triggers a grouping for every Week.

 

 

dateBiWeekly

Triggers a grouping for every second Week.

 

 

dateSemiMonthly

Triggers a grouping for every half Month.

 

 

dateMonthly

Triggers a grouping for every Month.

dateQuarterly

Triggers a grouping for every quarter Year.

 

 

dateSemiAnnually

Triggers a grouping for every half Year.

 

 

dateAnnually

Triggers a grouping for every Year.

 

 

For Groups based on Boolean fields, the options are:

Condition

Description

 

 

 

 

boolToYes

Triggers a grouping every time the Group field value changes from

 

No to Yes.

 

 

boolToNo

Triggers a grouping every time the Group field value changes from

 

Yes to No.

boolEveryYes

Triggers a grouping every time the Group field value is Yes.

 

 

boolEveryNo

Triggers a grouping every time the Group field value is No.

 

 

boolNextIsYes

Triggers a grouping every time the next value in the Group field is

 

Yes.

boolNextIsNo

Triggers a grouping every time the next value in the Group field is

 

No.

 

 

Example

The code below sets the first Group of a Report to a date field, with the Condition for the Group set to "daily":

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

Crpe1.GroupCondition.Retrieve;

Crpe1.GroupCondition[0].Field := '{invoice.DATE}';

Crpe1.GroupCondition[0].Condition := dateDaily;

Crpe1.GroupCondition[0].Direction := gcDescending;

Crpe1.Output := toWindow;

Crpe1.Execute;

VCL Reference

366

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