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

Description

This method can be used to clear the internal memory of the Params 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, but may be called in code as desired.

The Clear method is only applied to the Params object of the current Report/Subreport specified in the Subreports object. Therefore, to clear all the Params of all the Subreports will require a looping procedure that goes through each Subreport and applies the Clear method.

Example

This code clears the Params properties for the main Report (assuming the default state of Subreports[0]):

Crpe1.SQL.Params.Clear;

This code clears the Params properties for all the Subreports:

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

Crpe1.Subreports[cnt];

Crpe1.SQL.Params.Clear; end;

SQL Params CopyFrom method

Declaration

function CopyFrom(Source: TCrpeStoredProcParams): boolean;

Description

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

Example

The following example copies all the Params property values to a temporary TCrpeStoredProcParams object:

var

tempParams : TCrpeStoredProcParams; begin

tempParams := TCrpeStoredProcParams.Create; tempParams.CopyFrom(Crpe1.SQL.Params);

{...later, when finished with the temp object...} tempParams.Free;

end;

VCL Reference

642

SQL Params Count method

Declaration

function Count: integer;

Description

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

for cnt := 0 to (Crpe1.SQL.Params.Count - 1) do Crpe1.SQL.Params[cnt].Value := 'CA';

end;

SQL Params Create method

Declaration

constructor Create;

Description

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

SQL Params Delete method

Declaration

procedure Delete(nIndex: integer);

VCL Reference

643

Description

The Delete method can be used to remove an item from the Params object. The "nIndex" parameter represents the number of the item in the Params object.

NOTE: Delete will not remove the Stored Procedure Parameters 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 Params object:

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

{Specify Parameter Name - must be same as in Report} Crpe1.SQL.Params.Add('Parameter1'); Crpe1.SQL.Params.Value := 'CA';

Crpe1.Output := toWindow; Crpe1.Execute; Crpe1.SQL.Params.Delete(0);

SQL Params 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.

SQL Params Retrieve method

Declaration

function Retrieve: boolean;

Description

The Retrieve method obtains the Stored Procedure Parameter information from the Report and adds one item to the Params object for each Stored Procedure Parameter in the Report. If Stored Procedure Parameters were not found, the call returns False. Be aware that calling Retrieve will first cause the Params object to be cleared, so any current information stored in it will be removed.

VCL Reference

644

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

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

end;

SQL Params Send method

Declaration

function Send: boolean;

Description

The Send method sends the Params 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.

VCL Reference

645

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