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

Example

The Add method can be used to manually add an item to the Ranges object:

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

{Specify Range Number} Crpe1.ParamFields[0].Ranges.Add(0); Crpe1.ParamFields[0].Ranges[0].RangeStart := 'CA'; Crpe1.ParamFields[0].Ranges[0].RangeEnd := 'WA';

Crpe1.ParamFields[0].Ranges[0].RangeBounds := IncludeStartAndEnd; Crpe1.Output := toWindow;

Crpe1.Execute;

ParamFields Ranges Clear method

Declaration

procedure Clear;

Description

This method can be used to clear the internal memory of the ParamField Ranges object. It is called automatically if the Clear method is called for the main component, or if a new Report name is assigned to the ReportName property, or if the Paramfield.Clear method is called, but may be called in code as desired.

Example

This code clears the ParamField Ranges for the first ParamField in the main Report (assuming the default state of Subreports[0]):

Crpe1.ParamFields[0].Ranges.Clear;

NOTE: Using ParamFields.Clear instead, will clear all the Ranges for all the ParamFields at once.

ParamFields Ranges CopyFrom method

Declaration

function CopyFrom(Source: TCrpeParamFieldRanges): boolean;

Description

The CopyFrom method copies the Ranges property values from another TCrpeParamFieldRanges object. It is similar to Delphi's Assign method. It is useful for transferring or temporary storage of values.

VCL Reference

467

Example

The following example copies all the Ranges property values to a temporary TCrpeParamFieldRanges object:

var

tempRanges : TCrpeParamFieldRanges;

begin

tempRanges := TCrpeParamFieldRanges.Create; tempRanges.CopyFrom(Crpe1.ParamFields.Ranges); {...later, when finished with the temp object...} tempRanges.Free;

end;

ParamFields Ranges Count method

Declaration

function Count: integer;

Description

The Count method can be used to obtain the number of items currently in the Ranges 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.ParamFields.Retrieve;

if Crpe1.ParamFields[0].Ranges.Count > 0 then begin

for cnt := 0 to (Crpe1.ParamFields[0].Ranges.Count - 1) do Crpe1.ParamFields[0].Ranges[cnt].RangeBounds := IncludeStartAndEnd;

end; end;

ParamFields Ranges Create method

Declaration

constructor Create;

VCL Reference

468

Description

The Create method is used internally in the Crystal component to create the Ranges object, and does not need to be called in code, unless you are using the CopyFrom method to store Ranges data to a temporary object:

var

tempRanges : TCrpeParamFieldRanges; begin

tempRanges := TCrpeParamFieldRanges.Create; tempRanges.CopyFrom(Crpe1.ParamFields.Ranges);

end;

ParamFields Ranges Delete method

Declaration

procedure Delete(nIndex: integer);

Description

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

Example

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

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

{Specify Range Number} Crpe1.ParamFields[0].Ranges.Add(0); Crpe1.ParamFields[0].Ranges[0].RangeStart := 'CA'; Crpe1.ParamFields[0].Ranges[0].RangeEnd := 'WA';

Crpe1.ParamFields[0].Ranges[0].RangeBounds := IncludeStartAndEnd; Crpe1.Output := toWindow;

Crpe1.Execute;

{Specify the item number} Crpe1.ParamFields[0].Ranges.Delete(0);

ParamFields Ranges Destroy method

Declaration

destructor Destroy;

VCL Reference

469

Description

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

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.

ParamFields Ranges Retrieve method

Declaration

function Retrieve: boolean;

Description

The Retrieve method obtains the Parameter Field Ranges information (for the current ParamFields item) from the Report and stores it in the Ranges object. If Ranges information was not found, the call returns False. If there are no Ranges items in the Report, they can be added using the manual Add method.

Example

In this code example, the first ParamField item is manually created using the Add method. The Add method requires the Parameter Name (assumed as "Parameter1" in this example) and the Report Name (blank for the main Report). Then the ParamField Ranges property values are retrieved:

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

Crpe1.ParamFields.Add('Parameter1', '');

Crpe1.ParamFields[0].Ranges.Retrieve;

ParamFields Ranges Send method

Declaration

function Send: boolean;

Description

The Send method sends the Ranges 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), or when ParamFields.Send is called.

VCL Reference

470

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