FinishBatchCommand;
The FinishBatchCommand method finishes batch export of data to a file.
This method is used together with the IExAnalyzerExporter.StartBatchCommand method.
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;
// Create a filter for repository object opening dialog box.
Filter := New MetabaseDialogClassFilter.Create;
Filter.Description := "Express reports";
// Determine type of objects to be displayed in the dialog box
//when using this filter: 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 completed");
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: