IMetabaseUpdateRemappings.FindByOldId

Fore Syntax

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

Fore.NET Syntax

FindByOldId(ClassId: integer; Id: string): Prognoz.Platform.Interop.Metabase.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.

Fore 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
        // Output 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, output information about it to 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 in the collection of repeated mappings. If the element is found, the console window displays information about it.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Public Sub GetInfo(UpdRemaps: IMetabaseUpdateRemappings; ClassId: Integer; ObjId: String);
Var
    UpdRemap: IMetabaseUpdateRemapping;
Begin
    If Not UpdRemaps.IsEmpty Then
        // Output repeated mapping type
        System.Diagnostics.Debug.Write("Type of repeated mapping: ");
        Select Case UpdRemaps.Type
            Case MetabaseUpdateRemappingType.murtUnknown: System.Diagnostics.Debug.WriteLine("unknown type");
            Case MetabaseUpdateRemappingType.murtObject: System.Diagnostics.Debug.WriteLine("repository object");
            Case MetabaseUpdateRemappingType.murtHierarchy: System.Diagnostics.Debug.WriteLine("alternative hierarchy");
            Case MetabaseUpdateRemappingType.murtMetafactsAttribute: System.Diagnostics.Debug.WriteLine("time series attributes");
            Case MetabaseUpdateRemappingType.murtMetavalsAttribute: System.Diagnostics.Debug.WriteLine("observation attributes");
            Case MetabaseUpdateRemappingType.murtNone: System.Diagnostics.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, output information about it to console window
        System.Diagnostics.Debug.WriteLine("New object identifier: " + UpdRemap.NewId);
        System.Diagnostics.Debug.WriteLine("Old object identifier: " + UpdRemap.OldId);
        System.Diagnostics.Debug.WriteLine("New object identifier: " + UpdRemap.NewKey.ToString());
        System.Diagnostics.Debug.WriteLine("Old object key: " + UpdRemap.OldKey.ToString());
    End If;
End Sub GetInfo;

See also:

IMetabaseUpdateRemappings