IRdsDictionaryInstance.ClearData

Fore Syntax

ClearData([ForceClearReferences: Boolean = False]);

Fore.NET Syntax

ClearData(ForceClearReferences: boolean);

Parameters

ForceClearReferences. Optional parameter in Fore. It determines whether elements are to be force deleted if there are links to them in related dictionaries.

Description

The ClearData method clears all the elements from an MDM dictionary.

Comments

The method is executed taking into account the ForceClearReferences parameter. Available parameter values:

NOTE. The elements are deleted without taking into account the parameters of opening the dictionary. To open the dictionary with the parameters, use the IMetabaseObjectDescriptor.Open method.

Fore Example

Executing the example requires the repository that contains an MDM repository with the MDM identifier containing an MDM dictionary with the MDM_DICT identifier.

Add links to the Metabase, Rds system assemblies.

Sub UserClearDict;
Var
    MB: IMetabase;
    MDMObj: IMetabaseObjectDescriptor;
    Dict: IRdsDictionary;
    DictInst: IRdsDictionaryInstance;
Begin
    MB := MetabaseClass.Active;
    
// Get MDM repository
    MDMObj := MB.ItemById("MDM");
    
// Get MDM dictionary
    Dict := MB.ItemByIdNamespace("MDM_DICT", MDMObj.Key).Bind As IRdsDictionary;
    
// Open dictionary
    DictInst := Dict.Open(Null);
    
// Delete all elements
    DictInst.ClearData(True);
End Sub UserClearDict;

After executing the example all elements are deleted from the MDM_DICT dictionary.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MDMObj: IMetabaseObjectDescriptor;
    Dict: IRdsDictionary;
    DictInst: IRdsDictionaryInstance;
Begin
    MB := Params.Metabase;
    // Get MDM repository
    MDMObj := MB.ItemById["MDM"];
    // Get MDM dictionary
    Dict := MB.ItemByIdNamespace["MDM_DICT", MDMObj.Key].Bind() As IRdsDictionary;
    // Open dictionary
    DictInst := Dict.Open(Null);
    // Delete all elements
    DictInst.ClearData(True);
End Sub;

See also:

IRdsDictionaryInstance