Jaa


RecordInsertList.add(Common) Method

Definition

Adds a record to a RecordInsertList object for subsequent insertion into the database.

public:
 virtual int add(Microsoft::Dynamics::Ax::Xpp::Common ^ _record);
public virtual int add (Microsoft.Dynamics.Ax.Xpp.Common _record);
abstract member add : Microsoft.Dynamics.Ax.Xpp.Common -> int
override this.add : Microsoft.Dynamics.Ax.Xpp.Common -> int
Public Overridable Function add (_record As Common) As Integer

Parameters

_record
Common

A database buffer of the same type that is used to instantiate the class.

Returns

An integer that indicates whether the record has been successfully added to the list.

Remarks

The add method can flush records to the database whenever this will speed up performance. However, to guarantee that all records in the list are inserted, use the RecordInsertList.insertDatabase method.

The following example uses the RecordInsertList class to copy a BOM from one BOM to another. The add method is used to add all the records in the BOM to the RecordInsertList object before a final call is made to the insertDatabase method to insert all remaining records.

void copyBOM(BOMId _FromBOM, BOMId _ToBOM) 
{ 
    RecordInsertList BOMList; 
    BOM BOM, newBOM; 
    BOMList = new RecordInsertList(tableNum(BOM)); 
    while select BOM 
    where BOM.BOMId == _FromBOM 
    { 
        newBOM.data(BOM); 
        newBOM.BOMId = _ToBOM; 
        BOMList.add(newBOM); 
    } 
    BOMList.insertDatabase(); 
}

Applies to