IMetabase.GetObjectKeyById

Syntax

GetObjectKeyById(Value: String): Integer;

Parameters

Value. Object identifier.

Description

The GetObjectKeyById method returns a unique object key, which identifier is passed by the input parameter.

Comments

If the method is used via the Fore code, provided that the object with the specified identifier already does not exist, the method returns -1.

If the code is written in third-party development environments, and the object with the specified identifier does not exist, the method returns UInteger.MaxValue.

Example

Executing the example requires that the repository contains an object with the TestObj identifier.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    ObjKey: Integer;
Begin
    MB := MetabaseClass.Active;
    ObjKey := MB.GetObjectKeyById(
"TestObj");
    
If ObjKey <> -1 Then
        MB.DeleteObject(ObjKey);
    
End If;
End Sub UserProc;

After executing the example if the repository contains an object with the TestObj identifier, it is deleted.

See also:

IMetabase | IMetabase.GetObjectKeyByIdNamespace