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

GroupOptions Create method

Declaration

constructor Create;

Description

The Create constructor creates the GroupOptions object. It is used internally in the VCL component to create the GroupOptions object when the component is created, and should not be called outside of the component.

GroupOptions Delete method

Declaration

procedure Delete(nIndex: integer);

Description

The Delete method can be used to remove an item from the GroupOptions object. The "nIndex" parameter represents the number of the item in the GroupOptions object, which should not be confused with the Group Number value.

Example

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

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

{Specify Group Number - must be same as in Report} Crpe1.GroupOptions.Add(1); Crpe1.GroupOptions.KeepTogether := cTrue; Crpe1.Output := toWindow;

Crpe1.Execute;

{Specify the item number} Crpe1.GroupOptions.Delete(0);

GroupOptions Destroy method

Declaration

destructor Destroy; override;

VCL Reference

379

Description

The Destroy method frees the GroupOptions object. It is used internally in the VCL component to destroy the GroupOptions object when the component is destroyed, and should not be called outside of the component.

NOTE: The TCrpe component is responsible for creating and freeing all of the sub-classes that belong to it. The only time you would want to be concerned with doing this is if you are creating a temporary object to store data from the TCrpe using the CopyFrom method that is available from the sub-class or the CopyFrom method that is available from the main TCrpe class.

GroupOptions Retrieve method

Declaration

function Retrieve: boolean;

Description

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

NOTE: Since the GroupOptions object also applies to Subreports, the Retrieve method will obtain the GroupOptions for the Report (or Subreport) that the Subreports object index is currently pointing to. If you want to obtain the GroupOptions 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 GroupOptions 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.GroupOptions.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

VCL Reference

380

begin

Crpe1.Subreports[cnt];

Crpe1.GroupOptions.Retrieve; end;

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

end;

GroupOptions Send method

Declaration

function Send: boolean;

Description

The Send method sends the GroupOptions 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 GroupOptions settings are sent from the Crystal component to the Crystal Reports Print Engine DLL. This is normally handled automatically in the Execute method:

Crpe1.GroupOptions.Send;

GroupSelection Properties

GroupSelection Formula property

Declaration

property Formula: TCrpeString;

Type

TCrpeString = class(TStringList)

VCL Reference

381

Description

The Formula property specifies the actual GroupSelection Formula text.

When the Replace property is set to False, the GroupSelection Formula that is passed in to the Report is appended with a Boolean "AND" to any characters in the GroupSelection Formula currently in the Report. This includes comment lines (any text on a line with two forward slashes in front of it) and existing GroupSelection Formulas. Therefore, care must be taken to make sure the GroupSelection Formula in the Report is valid. When in doubt, use the Retrieve method and build the whole statement in Delphi, then replace the current GroupSelection, by setting Replace to True.

See also: Using Variables with GroupSelection Formula, Page 44

Example

The following example retrieves the current Group Selection Formula from the Report and adds an OR condition:

Crpe1.ReportName := 'C:\Company.rpt'; {Retrieve the GroupSelection} Crpe1.GroupSelection.Retrieve;

{Add an OR condition} Crpe1.GroupSelection.Formula.Add(' OR Maximum({company.BRANCHES},{company.STATE}) > 12');

{Replace the GroupSelection in the Report with the new one} Crpe1.GroupSelection.Replace := True;

{Check the GroupSelection before running Report} if Crpe1.GroupSelection.Check then

begin

Crpe1.Output := toWindow; Crpe1.Execute;

end;

GroupSelection Replace property

Declaration

property Replace: boolean;

Description

The Replace property determines if the Group Selection Formula sent from the VCL will replace the one that is already in the Report (if there is one), or if it will be ANDed on to the end. For example, if there is a Selection Formula in the Report that reads:

{company.STATE} = "WA"

VCL Reference

382

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