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

Example

The following code illustrates the use of the ItemIndex property to make sure the Ranges object is pointing to the first Range:

if Crpe1.ParamFields[0].Ranges.ItemIndex <> 0 then Crpe1.ParamFields[0].Ranges[0];

ParamFields Ranges Number property

Declaration

property Number: TCrRangeNumber;

Type

TCrRangeNumber = integer;

Description

The Number property specifies the Range Number of the item that the Ranges object is currently pointing to.

Example

This example retrieves the ParamFields values from the Report (the Range values are retrieved with the ParamFields), and uses the Number property to set the first Range:

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

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

{Set the ParamFields Ranges object to the first Range} Crpe1.ParamFields[0].Ranges.Number := 0;

{Assign the values for the first Range} Crpe1.ParamFields[0].Ranges.RangeStart := 'CA'; Crpe1.ParamFields[0].Ranges.RangeEnd := 'WA'; Crpe1.ParamFields[0].Ranges.RangeBounds := IncludeStartAndEnd;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

VCL Reference

463

ParamFields Ranges RangeBounds property

Declaration

property RangeBounds: TCrRangeBounds;

Type

TCrRangeBounds = (IncludeStartAndEnd, IncludeStartOnly, IncludeEndOnly,

ExcludeStartAndEnd);

Description

The RangeBounds property determines whether the limit of values that can be entered into the Parameter include the RangeStart and RangeEnd values, or exclude them. When using the Add method, the default setting for RangeBounds is IncludeStartAndEnd.

Example

The following example illustrates the use of the Ranges object:

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

{ByPass the Parameter Prompt Dialog} Crpe1.ParamFields[0].ShowDialog := False; {Make sure ValueType is set to Ranges}

Crpe1.ParamFields[0].Info.ValueType := vtRanges; {Clear Ranges, just to be safe} Crpe1.ParamFields[0].Ranges.Clear;

{Add a Range} 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 RangeEnd property

Declaration

property RangeEnd: string;

VCL Reference

464

Description

The RangeEnd property determines the starting value of the Range. Depending on the setting of the RangeBounds property, the actual Range (as Crystal Reports sees it) will either include the RangeEnd value, or exclude it.

Example

The following example illustrates the use of the Ranges object:

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

{ByPass the Parameter Prompt Dialog} Crpe1.ParamFields[0].ShowDialog := False; {Make sure ValueType is set to Ranges}

Crpe1.ParamFields[0].Info.ValueType := vtRanges; {Clear Ranges, just to be safe} Crpe1.ParamFields[0].Ranges.Clear;

{Add a Range} 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 RangeStart property

Declaration

property RangeStart: string;

Description

The RangeStart property determines the starting value of the Range. Depending on the setting of the RangeBounds property, the actual Range (as Crystal Reports sees it) will either include the RangeStart value, or exclude it.

VCL Reference

465

Example

The following example illustrates the use of the Ranges object:

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

{ByPass the Parameter Prompt Dialog} Crpe1.ParamFields[0].ShowDialog := False; {Make sure ValueType is set to Ranges}

Crpe1.ParamFields[0].Info.ValueType := vtRanges; {Clear Ranges, just to be safe} Crpe1.ParamFields[0].Ranges.Clear;

{Add a Range} 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 Add method

Declaration

procedure Add(RangeNumber: TCrRangeNumber);

Type

TCrRangeNumber = integer;

Description

The Add method adds an item to the Ranges object and sets the internal index to that item. It requires a Range number (zero based) as a parameter.

The steps to using the Add method with Ranges are:

1Add an item to the Ranges object (you must specify the Range Number).

2Fill the item's properties (RangeStart, RangeEnd, and RangeBounds) with values.

3When Execute is called, the properties will be sent to the Print Engine.

NOTE: If the Parameter is set up to expect a single Range (ParamFields.Info.AllowMultipleValues is set to cFalse), then only one Range item will be required. If the Parameter is set up to expect an array of Ranges (ParamFields.Info.AllowMultipleValues is set to cTrue), then as many Range items as desired can be added to the Ranges object.

VCL Reference

466

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