IExAnalyzerExporter.StartBatchCommand

Syntax

StartBatchCommand(FileName: String; FormatTag: String);

Parameters

FileName. The name of the file for export.

FormatTag. The format of the file for export. Export is available to the following formats:

Description

The StartBatchCommand method starts batch data export to a file of the specified format.

Comments

After calling this method, each time the  IExporter.ExportToFile  method is called, the report specified in the IExAnalyzerExporter.ExAnalyzer property is exported. Export is performed to the file with parameters set for the StartBatchCommand method. To finish batch data export, call the IExAnalyzerExporter.FinishBatchCommand method. Thus, several reports may be exported to a single file.

Example

Executing the example requires a form, a button named Button1 on the form, the MetabaseOpenDialog component named MetabaseOpenDialog1 and the Memo component named Memo1. The example is executed on clicking the Button1 button.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Filter: IMetabaseDialogClassFilter;
    Objects: IMetabaseObjectDescriptorList;
    List: IStringList;
    Exp: ExAnalyzerExporter;
    i: integer;
    id: String;
    Count: Integer;
Begin
    MetabaseOpenDialog1.MultiSelect := 
True;
    
// Creating filter for  dialog  box of opening repository object.
    Filter := New MetabaseDialogClassFilter.Create;
    Filter.Description := 
"Express reports";
    //Select type of objects to be displayed in the dialog box
    //when this filter is used: express - report.
    Filter.ObjectClass := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
    MetabaseOpenDialog1.Filters.AddFilter(Filter);
    
If MetabaseOpenDialog1.Execute(Self) Then
        
//These operations are  performed if the user selects one or more express reports.
        Objects := MetabaseOpenDialog1.Objects;
        Count := Objects.Count;
        List := Memo1.Lines;
        List.Add(
"Number of  reports to  be exported:" + Count.ToString);
        
// Start  batch  export  of selected  reports.
        Exp := New ExAnalyzerExporter.Create;
        Exp.StartBatchCommand(
"C:\BatchFileExp.xls""XLS");
        
For i := 0 To Count - 1 Do
            id := Objects.Item(i).Id;
            Exp.ExAnalyzer := MetabaseClass.Active.ItemById(id).Bind 
As IEaxAnalyzer;
            Exp.ExportToFile(
"""XLS");
            List.Add(
"Report '" + Objects.Item(i).Name + "' Exported");
        
End For;
        
// Finish  batch  export of selected  reports.
        Exp.FinishBatchCommand;
        List.Add(
"Report  export  complete");
    
End If;
End Sub Button1OnClick;

The dialog box of repository object opens when executing the example. In this dialog box, select the express reports to be exported. After the objects are selected, they are exported to the C:\BatchFileExp.xls file. Export progress reports are displayed in the Memo1 component.

See also:

IExAnalyzerExporter