IAdhocReportExporter.StartBatchCommand

Syntax

StartBatchCommand(FileName: String; FormatTag: String);

Parameters

FileName. Name of the file, to which export is executed.

FormatTag. Format of the file, in which export is executed.

Available export formats

Description

The StartBatchCommand method starts batch export of dashboards of the specified format.

Comments

Batch export enables the user to export several dashboards to one file.

To execute batch export:

  1. Call the StartBatchCommand method.

  2. Set the exported dashboard in the IAdhocReportExporter.AdhocReport property.

  3. Call the IAdhocReportExporter.ExportToFile method inherited from IExporter.ExportToFile.

  4. Repeat steps 2 and 3 as long as all required dashboards are exported.

  5. Call the IAdhocReportExporter.FinishBatchCommand method.

Example

Executing the example requires a form containing the MetabaseOpenDialog component with the MetabaseOpenDialog1 identifier.

Add a link to the Adhoc system assembly.

Sub UserProc;
Var
    Filter: IMetabaseDialogClassFilter;
    Objects: IMetabaseObjectDescriptorList;
    Exp: AdhocReportExporter;
    i, Count: integer;
    id: String;
Begin
    MetabaseOpenDialog1.MultiSelect := True;
    // Create filter to open only dashboards
    Filter := New MetabaseDialogClassFilter.Create;
    Filter.Description := "Dashboards";
    Filter.ObjectClass := MetabaseObjectClass.KE_ADHOC_REPORT;
    MetabaseOpenDialog1.Filters.AddFilter(Filter);
    // Call dashboard open box
    If MetabaseOpenDialog1.Execute(Self) Then
        Objects := MetabaseOpenDialog1.Objects;
        Count := Objects.Count;
        // Start of batch export of selected dashboards in PDF format
        Exp := New AdhocReportExporter.Create;
        Exp.StartBatchCommand("C:\Dashboards.pdf""PDF");
        For i := 0 To Count - 1 Do
            id := Objects.Item(i).Id;
            Exp.AdhocReport := MetabaseClass.Active.ItemById(id).Bind As IAdhocReport;
            Exp.ExportToFile("""PDF");
            Debug.WriteLine("Report '" + Objects.Item(i).Name + "' is exported");
        End For;
        // End of batch export  of dashboards
        Exp.FinishBatchCommand;
    End If;
End Sub UserProc;

After executing the example the dialog box to select dashboards opens. The selected dashboards will be exported to the C:\Dashboards.pdf file, the console window displays messages about export progress.

See also:

IAdhocReportExporter