IDatasetBatchUpdate.Fields

Syntax

Fields: IDatasetInstanceFields;

Description

The Fields property returns a collection of fields values for current record of a data source.

Example

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

Sub Main;

Var

MB: IMetabase;

Dsi: IDatasetInstance;

Fields: IDatasetInstanceFields;

Dbu: IDatasetBatchUpdate;

Vals: Array[0..2] Of Variant;

i: Integer;

Begin

MB := MetabaseClass.Active;

Dsi := MB.ItemById("Table_1").Open(Null) As 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 Main;

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