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

GraphData Count method

Declaration

function Count: integer;

Description

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

for cnt := 0 to (Crpe1.GraphData.Count - 1) do Crpe1.GraphData[cnt].SummarizedFieldN := 2;

end;

GraphData Create method

Declaration

constructor Create;

Description

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

GraphData Delete method

Declaration

procedure Delete(nIndex: integer);

VCL Reference

310

Description

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

Example

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

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

{Specify Graph Number - must be same as in Report} Crpe1.GraphData.Add(0);

{Section must also be specified when using Add} Crpe1.GraphData.Section := 'PH'; Crpe1.GraphData.SummarizedFieldN := 2; Crpe1.Output := toWindow;

Crpe1.Execute;

Crpe1.GraphData.Delete(0);

GraphData 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.

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.

GraphData Retrieve method

Declaration

function Retrieve: boolean;

Description

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

VCL Reference

311

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

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

end;

GraphData SectionType method

Declaration

function SectionType: string;

Description

The SectionType method returns the Section Code without the subsection specifier. In other words, if the Section Code for an item is GH1ac, the SectionType method would return GH; if the SectionCode is Da, the SectionType method would return D.

The primary use for this method is to apply changes to all the Sections in an area, regardless of the sub-section specifier. See the Example for an illustration.

VCL Reference

312

Example

The following example uses the SectionType method to apply conditional changes to Graphs. In this case, there is a Graph in each of three sections (RH, GH1a, GH2a). Only the Graphs in the Group Headers should be changed, so the SectionType method can be used in an expression to apply the changes:

var

cnt: integer; begin

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

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

{if the SectionType is GroupHeader, apply the change} if (Crpe1.GraphData[cnt].SectionType = 'GH') then

Crpe1.GraphData[cnt].SummarizedFieldN := 1;

end; end;

GraphData Send method

Declaration

function Send: boolean;

Description

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

Crpe1.GraphData.Send;

VCL Reference

313

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