ItemById(Id: String): IMetabaseObjectDescriptor;
ItemById[Id: String]: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;
Id.Identifier of repository object.
The ItemById property returns description of the repository object with the specified identifier.
All object identifiers are unique in the frame of repository. Objects-containers (MDM repository, modelling container, web application) has their own identifier space, so objects with the same identifiers as in repository can be created there.
The ItemById property returns description of the object, if their identifier will be found in repository object tree. The objects-containers contents is not considered. To work with objects inside objects-containers, use the IMetabase.ItemByIdNamespace property.
The property returns Null, if object with the specified identifier is not found in repository object tree.
To execute the example, add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
MDesc: IMetabaseObjectDescriptor;
Begin
MB := MetabaseClass.Active;
MDesc := MB.ItemById("TestObj");
If MDesc <> Null Then
Debug.WriteLine(MDesc.Name);
Else
Debug.WriteLine("Object is absent in repository objects. Perhaps, it exists in one of objects - containers.");
End If;
End Sub UserProc;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MDesc: IMetabaseObjectDescriptor;
Begin
MB := Params.Metabase;
MDesc := MB.ItemById["TestObj"];
If MDesc <> Null Then
System.Diagnostics.Debug.WriteLine(MDesc.Name);
Else
System.Diagnostics.Debug.WriteLine("Object is absent in repository objects. Perhaps, it exists in one of objects - containers.");
End If;
End Sub;
After executing the example if an object with the TestObj identifier exists in the repository, its name is displayed in a development environment console.
See also: