IMetabaseObjectCreateInfo.Link

Fore Syntax

Link: IMetabaseLink;

Fore.NET Syntax

Link: Prognoz.Platform.Interop.Metabase.IMetabaseLink;

Description

The Link property determines a connection with repository.

Comments

This property is used if the shortcut for the object from another repository is created. The Connection with Repository object is used to connect with the repository. On creating the link to the object from the another repository as the value of the ClassId property the object class, to which it is referred, should be specified. The description of the object is specified in the Shortcut property, the IsShortcut property must be set to False.

Fore Example

Executing the example requires the Repository Connection object with the Link_Test identifier. There is a regular report with the Report_1 identifier in the repository with which the connection was established.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    Link: IMetabaseObject;
    LinkInst: IMetabaseLinkInstance;
    ObjDesc: IMetabaseObjectDescriptor;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.Id := 
"Shortcut_Report_1";
    CrInfo.Name := 
Shortcut for Report_1;
    CrInfo.Parent := MB.Root;
    CrInfo.Permanent := 
True;
    Link := MB.ItemById(
"Link_Test").Bind;
    LinkInst := Link.Open(
NullAs IMetabaseLinkInstance;
    ObjDesc := LinkInst.Metabase.ItemById(
"Report_1");
    CrInfo.Link := Link 
As IMetabaseLink;
    CrInfo.ClassId := ObjDesc.ClassId;
    CrInfo.Shortcut := ObjDesc;
    MB.CreateObject(CrInfo);
End Sub UserProc;

After executing the example in the root of the repository the shortcut for the Report_1 regular report will be created.

Fore.NET Example

Executing the example requires the Repository Connection object with the Link_Test identifier. There is a regular report with the Report_1 identifier in the repository with which the connection was established.

Imports Prognoz.Platform.Interop.Metabase;

Public Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    Link: IMetabaseObject;
    LinkInst: IMetabaseLinkInstance;
    ObjDesc: IMetabaseObjectDescriptor;
Begin
    MB := Params.Metabase;
    CrInfo := MB.CreateCreateInfo();
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_PROCEDURALREPORT As Int32;
    CrInfo.Id := "Shortcut_Report_1";
    CrInfo.Name := Shortcut for Report_1;
    CrInfo.Parent := MB.Root;
    CrInfo.Permanent := True;
    Link := MB.ItemById["Link_Test"].Bind();
    LinkInst := Link.Open(NullAs IMetabaseLinkInstance;
    ObjDesc := LinkInst.Metabase.ItemById["Report_1"];
    CrInfo.Link := Link As IMetabaseLink;
    CrInfo.ClassId := ObjDesc.ClassId;
    CrInfo.Shortcut := ObjDesc;
    MB.CreateObject(CrInfo);
End Sub;

After executing the example in the root of the repository the shortcut for the Report_1 regular report will be created.

See also:

IMetabaseObjectCreateInfo | Working with Shortcut