Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

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

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
    Martin Dráb 230,198 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
    xiaoshuai.fan 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
    xiaoshuai.fan 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
    Martin Dráb 230,198 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
    xiaoshuai.fan 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
    Martin Dráb 230,198 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
    Hossein.K 6,642 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
    Hossein.K 6,642 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
    xiaoshuai.fan 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
    xiaoshuai.fan 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans