IAdhocReport.SaveToStream

Syntax

SaveToStream(Stream: IIOStream);

Parameters

Stream. A stream where a dashboard is saved.

Description

The SaveToStream method saves a dashboard to a stream.

Comments

To load the dashboard from the stream, use the IAdhocReport.LoadFromStream method.

Example

Executing the example requires that the repository contains a dashboard with the ADHOC identifier.

Add links to the Adhoc, IO and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    AdhocReport: IAdhocReport;
    Stream: IMemoryStream;
Begin
    MB := MetabaseClass.Active;
    AdhocReport := MB.ItemById("ADHOC").Bind As IAdhocReport;
    // Save report in stream
    Stream := New MemoryStream.Create;
    AdhocReport.SaveToStream(Stream);
    // Create a dashboard
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_ADHOC_REPORT;
    CrInfo.Id := "NEW_ADHOC";
    CrInfo.Name := "New dashboard";
    CrInfo.Parent := MB.Root;
    AdhocReport := MB.CreateObject(CrInfo).Edit As IAdhocReport;
    // Load report from the stream to dashboard
    AdhocReport.LoadFromStream(Stream);
    (AdhocReport As IMetabaseObject).Save;
    Dispose Stream;
End Sub UserProc;

After executing the example the report with the ADHOC identifier is saved to the stream. A new dashboard with the NEW_ADHOC identifier was created where the report was loaded from the stream.

See also:

IAdhocReport