IMetabaseUpdateDataObjectNode.FieldsOnly

Syntax

FieldsOnly: IStringList

Description

The FieldsOnly property determines a list of fields or attributes for update.

Comments

The property is not set by default, all table fields or dictionary attributes are updated on update installation. The data update method is determined by the IMetabaseUpdateDataObjectNode.BatchMode property.

To update specific fields or attributes, specify their identifiers in the FieldsOnly property. The specified fields or attributes will be updated on update installation for all table records or dictionary elements according to the selected object data update method.

To update specific records or elements, use the IMetabaseUpdateDataObjectNode.PrimaryKeysOnly property.

TIP. If the update contains dictionary tables or elements records that are absent in the object to be updated, check that the update contains all required attributes.

Example

Executing the example requires an MDM repository with the REP_NSI identifier containing an MDM dictionary with the DICT_1 identifier. It is assumed that the MDM dictionary contains general attributes ATTR4, ATTR5, dictionary elements with the 1, 2 keys.

Add links to the Metabase and Collections system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    MUpdate: IMetabaseUpdate;
    RootFolder: IMetabaseUpdateFolderNode;
    Node: IMetabaseUpdateDataObjectNode;
Begin
    
//Determine the current repository
    Mb := MetabaseClass.Active;
    
//Open update manager to create a new update
    MUpdate := Mb.CreateUpdate;
    
//Create an update structure
    RootFolder := MUpdate.RootFolder;
    Node := RootFolder.Add(MetabaseUpdateNodeType.DataObject) 
As IMetabaseUpdateDataObjectNode;
    //Determine an object update method 
    Node.BatchMode := ObjectUpdateDataBatchMode.UpdateInsert;
    
//Get object (MDM dictionary) located in container object (MDM repository)
    Node.Object := Mb.ItemByIdNamespace("DICT_1", Mb.ItemById("REP_NSI").Key).Bind;
    
//Determine an object data update method 
    Node.UpdatePart := MetabaseObjectUpdatePart.DataMetadata;
    
//Enumerate dictionary attributes to be updated
    Node.FieldsOnly.Add("ATTR4");
    
Node.FieldsOnly.Add("ATTR5");
    //Enumerate dictionary elements to be updated
    Node.PrimaryKeysOnly.Add(1Null);
    Node.PrimaryKeysOnly.Add(
2Null);
    
//Determine a full path and file name, to which update will be saved
    MUpdate.SaveToFileNF("C:\Dict_1.pefx");
End Sub UserProc;

After executing the example a new update is created. The update file will be located in the specified folder. The ATTR4, ATTR5 attributes of the elements with the 1, 2 keys of the DICT_1 MDM dictionary will be included in the update.

To install the created update, the repository to be updated is supposed to have an MDM repository with the REP_NSI identifier with MDM dictionary with the DICT_1 identifier. It is assumed that the MDM dictionary contains general attributes ATTR4, ATTR5, dictionary elements with the 1, 2 keys. Only the ATTR4, ATTR5 attributes of the dictionary elements with the 1, 2 keys will be updated. The rest of the attributes and elements will not be updated.

See also:

IMetabaseUpdateDataObjectNode