IMetabaseUpdateDataObjectNode.PrimaryKey

Syntax

PrimaryKey: String;

Description

The PrimaryKey property determines a list of fields/attributes that are primary keys.

Comments

The specified fields are used to check whether if the consumer table data differs from the source table data and to execute the specified update operation (for example, only add the records that are not found by the primary key). The fields in the list should be specified in the upper case and separated by the ";". The data update method is determined by the BatchMode property.

Example

Executing the example requires that the repository contains a table with the T_Data identifier. The table contains the UNIQUENAME field containing unique data.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MBDesc: IMetabaseObjectDescriptor;
    MUpdate: IMetabaseUpdate;
    ObjNode: IMetabaseUpdateDataObjectNode;
Begin
    MB := MetabaseClass.Active;
    MBDesc := MB.ItemById("T_Data");
    MUpdate := MB.CreateUpdate;
    MUpdate.BoundType := MetabaseObjectUpdateBoundType.ById;
    MUpdate.AlterType(MetabaseObjectClass.KE_CLASS_TABLE) := MetabaseObjectAlterType.Recreate;
    MUpdate.Description := "Update for table";
    ObjNode := MUpdate.RootFolder.Add(MetabaseUpdateNodeType.DataObject) As IMetabaseUpdateDataObjectNode;
    //Specify updated object
    ObjNode.Object := MBDesc;
    //Update options
    ObjNode.Label := MBDesc.Id;
    ObjNode.UpdatePart := MetabaseObjectUpdatePart.DataMetadata;
    ObjNode.BoundType := MetabaseObjectUpdateBoundType.ByKey;
    ObjNode.Method := MetabaseUpdateMethod.All;
    ObjNode.BatchMode := ObjectUpdateDataBatchMode.UpdateInsert;
    ObjNode.PrimaryKey := "UNIQUENAME";
    //Save update
    MUpdate.SaveToFileNF("C:\Update.pefx");
End Sub UserProc;

On executing the example an update file will be created. The update will include the specified table.

See also:

IMetabaseUpdateDataObjectNode