Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

_list.insertDatabase When the quantity is too much, the data cannot be entered completely

(0) ShareShare
ReportReport
Posted on by 75

I have 7000 pieces of data to process.

However, after the following logical processing, I found that only 210 entries actually entered the database。

data = GetData();

while(data.next())

{

TableTmp.clear();

.......

list.add(TableTmp);

}

Table.truncate();

list.insertDatabase();

  • Suggested answer
    Martin Dráb Profile Picture
    231,788 Most Valuable Professional on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    These are not settings; it's how the behavior of RecordInsertClass has been implemented.

    You can find a bit more details in documentation of RecordInsertClass class.

  • xiaoshuai.fan Profile Picture
    75 on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    Thanks for your reply

    Do you think my understanding is correct

    Small amount of data:

     Recordinsertlist. Add():  inserts data into the list

     Recordinsertlist. Insertdatabase():  inserts all data in the list into the DB

    When the amount of data is large:

     Recordinsertlist. Add():  inserts part of the data directly into the DB

     Recordinsertlist. insertdatabase():  ensure all data is inserted

    So is there any documentation of these settings?

  • xiaoshuai.fan Profile Picture
    75 on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    Thanks for your reply

    My code includes the processing of ttsbegin and ttscommit,

    So it is only possible to add all or fail all.

    So I suspect that the problem occurs when the data is added to the database and then deleted by truncate.

    Is there any information available in this regard?

  • Verified answer
    Martin Dráb Profile Picture
    231,788 Most Valuable Professional on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    Yes, add() may insert a bunch of records to database. insertDatabase() ensures that all not-yet-inserted records are inserted as well.

    No, it's not configurable, as far as I know.

  • xiaoshuai.fan Profile Picture
    75 on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    Thanks for your reply

    In fact, I have adjusted the order of truncate and the error has been solved.

    I want to confirm whether this setting really exists.

    【when the amount of data is too large, list. Add() is executed ,the data will be directly inserted into the database】

    If there is such a setting, where can I find the specific content

  • Martin Dráb Profile Picture
    231,788 Most Valuable Professional on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    I also think that truncating the table before actually in the middle of the process is a bad idea.

    There is an easy way to be certain - throw away the call of truncate() and try it again.

    By the way, what are you trying to achieve by truncate()?

  • Suggested answer
    Hossein.K Profile Picture
    6,646 on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    There is adocumentation of RecordInsertList class and set-based operations that it is useful and also you can read all four parts of Ax 2012 - RecordInsertList - Performance series.

    Also, creation a DMF entity for your table or a batch process with multiple threads can be a good idea for you.

  • Suggested answer
    Hossein.K Profile Picture
    6,646 on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    Hi xiaoshuai.fan,

    If you have overriden the insert method of the table, the insert will be made row by row and it take time.

  • xiaoshuai.fan Profile Picture
    75 on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    The following explanation can be seen in some places

    When the amount of data is too large, in list. Add(), the data will be submitted to the database.

    In this way, because I added truncate before insert, the data previously submitted to the database will be cleared.

    Since no official explanation has been found, it is uncertain whether this is the reason.

    And what is the amount of data control

  • xiaoshuai.fan Profile Picture
    75 on at
    RE: _list.insertDatabase When the quantity is too much, the data cannot be entered completely

    After debug, it is found that the number of while cycles is thousands.

    But there are only a few hundred data stored in the database

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,923 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,788 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans