IMetabaseUpdateRemappings.FindByOldId

Syntax

FindByOldId(ClassId: Integer; Id: String): IMetabaseUpdateRemapping;

Parameters

ClassId. Index of the class, to which element belongs.

Id. Element key in update.

Description

The FindByOldId method searches parameters of element mapping by its identifier and class in update.

Comments

Indexes of element classes are contained in the MetabaseObjectClass enumeration.

If parameters are not found, the method returns Null.

Example

The example is a custom procedure that searches the specified element in the collection of repeated mappings. Procedure parameters:

Sub GetInfo(UpdRemaps: IMetabaseUpdateRemappings; ClassId: Integer; ObjId: String);
Var
    UpdRemap: IMetabaseUpdateRemapping;
Begin
    If Not UpdRemaps.IsEmpty Then
        // Display repeated mapping type
        Debug.Write("Repeated mapping type: ");
        Select Case UpdRemaps.Type
            Case MetabaseUpdateRemappingType.Unknown: Debug.WriteLine("unknown type");
            Case MetabaseUpdateRemappingType.Object: Debug.WriteLine("repository object");
            Case MetabaseUpdateRemappingType.Hierarchy: Debug.WriteLine("alternative hierarchy");
            Case MetabaseUpdateRemappingType.MetafactsAttribute: Debug.WriteLine("time series attributes");
            Case MetabaseUpdateRemappingType.MetavalsAttribute: Debug.WriteLine("observation attributes");
            Case MetabaseUpdateRemappingType.None: Debug.WriteLine("type is not set");
        End Select;
    End If;
    // Search repeated mapping
    UpdRemap := UpdRemaps.FindByOldId(ClassId, ObjId);
    // Check if observation is found
    If UpdRemap <> Null Then
        // If mapping is found, display information about it in the console window
        Debug.WriteLine("New object identifier: " + UpdRemap.NewId);
        Debug.WriteLine("Old object identifier: " + UpdRemap.OldId);
        Debug.WriteLine("New object key: " + UpdRemap.NewKey.ToString);
        Debug.WriteLine("Old object key: " + UpdRemap.OldKey.ToString);
    End If;
End Sub GetInfo;

After executing the example the specified element is searched in the collection of repeated mappings. If the element is found, the console window displays information about it.

See also:

IMetabaseUpdateRemappings