IMetabase.GetObjectKeyById

Syntax

GetObjectKeyById(Value: String): Integer;

GetObjectKeyById(Value: string): uinteger;

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 Fore.NET or using 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;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    ObjKey: UInteger;
Begin
    MB := Params.Metabase;
    ObjKey := MB.GetObjectKeyById(
"TestObj");
    
If ObjKey <> uinteger.MaxValue Then
        MB.DeleteObject(ObjKey);
    
End If;
End Sub;

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

See also:

IMetabase | IMetabase.GetObjectKeyByIdNamespace