web
You’re offline. This is a read only version of the page.
close
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();

I have the same question (0)
  • xiaoshuai.fan Profile Picture
    75 on at

    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

  • xiaoshuai.fan Profile Picture
    75 on at

    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

  • Suggested answer
    Hossein.K Profile Picture
    6,648 on at

    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.

  • Suggested answer
    Hossein.K Profile Picture
    6,648 on at

    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.

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    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()?

  • xiaoshuai.fan Profile Picture
    75 on at

    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

  • Verified answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    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

    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?

  • xiaoshuai.fan Profile Picture
    75 on at

    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?

  • Suggested answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans