IAdhocReport.AddDataSourceLinkedObject

Syntax

AddDataSourceLinkedObject(Id: String; Object: IMetabaseObject): IAdhocDataSourceObject;

Parameters

Id. Dashboard object identifier.

Object. Repository object.

Description

The AddDataSourceLinkedObject method adds a block of the Express Report, Regular Report or Dashboard type.

Comments

To add a data source to visualizers, use the IAdhocReport.AddDataSourceObject property.

Example

Executing the example requires that the repository contains a dashboard with the DASHBOARD_ADSLO identifier and an express report with the EXP_ADSLO identifier.

Add links to the Adhoc, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Dashboard: IAdhocReport;
    DsObjs, DsOdjsL: IAdhocDataSourceObjects;
    i: Integer;
    DsObj: IAdhocDataSourceObject;
    mbo, mbol: IMetabaseObject;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get dashboard
    mbo := mb.ItemById("DASHBOARD_ADSLO").Edit;
    Dashboard := mbo As IAdhocReport;
    // Get dashboard data sources
    DsObjs := Dashboard.DataSourceObjects;
    DsOdjsL := Dashboard.DataSourceLinkedObjects;
    DsOdjsL.RemoveById("EXP_ADSLO");
    //Add a new linked data source
    mbol := mb.ItemById("EXP_ADSLO"As IMetabaseObject;
    DsObj := Dashboard.AddDataSourceLinkedObject("EXP_ADSLO", mbol);
    For i := 0 To DsOdjsL.Count - 1 Do
        // Get data source identifier
        DsObj := DsOdjsL.Item(i);
        Debug.WriteLine("data source identifier " + (i + 1).ToString + " - " + DsObj.Id);
    End For;
    mbo.Save;
End Sub UserProc;

After executing the example the console window displays data source identifiers. A linked data source is added to the dashboard.

See also:

IAdhocReport