IDatasetBatchUpdate.BeginUpdate

Syntax

BeginUpdate;

Description

The BeginUpdate method starts the update (clipboard clearing).

Example

Executing the example requires that the repository contains a table with the Table_1 identifier. The table contains three fields with integer values.

Sub UserProc;
Var
    MB: IMetabase;
    Dsi: IDatasetInstance;
    Fields: IDatasetInstanceFields;
    Dbu: IDatasetBatchUpdate;
    Vals: Array[0..2Of Variant;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    Dsi := MB.ItemById("Table_1").Open(NullAs IDatasetInstance;
    Fields := Dsi.Fields;
    Dbu := Dsi.CreateBatchUpdate;
    Dbu.BatchCommand := DatasetBatchCommand.Update;
    Dbu.KeyFieldNames := Fields.Item(0).Id;
    Dbu.BeginUpdate;
    While Not Dsi.Eof Do
        i := Fields.Item(0).Value As Integer;
        If i > 100 Then
            Vals[0] := i;
            Vals[1] := Fields.Item(1).Value;
            Vals[2] := (i + (Fields.Item(1).Value As Integer)) * 100;
            Dbu.AddRecord(Vals);
        End If;
        Dsi.Next;
    End While;
    Dbu.Commit;
End Sub UserProc;

After executing the example, records, which values of the first field are more than 100, are updated in the table. On updating, value of the third field is changed taking into account values of previous two fields.

See also:

IDatasetBatchUpdate