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

RecordInsertList and TempDB

(1) ShareShare
ReportReport
Posted on by 8
Hello,
I have a tempDB datasource on my form and I need to optimize my logic a bit.
I wanted to implement a RecordInsertList but there are no records being found in the temporay table using this.
The method to populate the temp table is as follows;
 
RecordInsertList list = new RecordInsertList(tableNum(XXXTableTmp));
XXXTableTmp tmp;
int countLoops;
 
while (qr.next())
{
CustTable custTable = qr.get(tablenum(CustTable));
tmp.CustAccount = custTable.AccountNum;
list.add(tmp);
countLoops++;
//tmp.doInsert()
}
 
if (countLoops)
{
ttsbegin;
list.insertdatabase();
ttscommit;
}
 
select * from tmp;
 
return tmp;
 
The doInsert() logic works perfectly fine. However not the insertrecordlist.
Is this the correct approach to do this?
I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    You need to tell RecordInsertList which temporary buffer it should insert records to:
     
    Notice the last argument of the constructor:
    XXXTableTmp tmp;
    RecordInsertList list = new RecordInsertList(tableNum(XXXTableTmp), true, true, true, true, true, tmp);
  • Suggested answer
    Ariba Mehdi Profile Picture
    166 on at
    Hi there,
     
    I believe that RecordInsertList is not initialized correctly. Please try initializing these elements like this:
     
    RecordInsertList list;
    CustTable custTable;
    list = new RecordInsertList(tableNum(custTable));
     
    Refer to these link: 
     
    Hope it helps!
     
     
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    Ariba, what problem do you think that your code solves? As far as I know, it's exactly the same thing as what Jason had, you just used a different table (CustTable) instead of XXXTableTmp.
     
    Your code can be rewritten as
    RecordInsertList list = new RecordInsertList(tableNum(CustTable));
    CustTable custTable;
    and it'll still behave exactly the same.
     
    It doesn't address the problem of the temporary table buffer.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,390 Super User 2025 Season 2 on at
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    Mohamed, please tell how these links solve the problem. All three look off-topic to me.
     
    Just posting some random links is not a way how make this forum useful.
  • Layan Jwei Profile Picture
    8,112 Super User 2025 Season 2 on at
    Hi Jason,
     
    Using recordInsertList with tmp tables requires specifying the tmp table buffer in the 7th argument of RecordInsertList() -- just as Martin showed you.
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
     
  • Jason0810M Profile Picture
    8 on at
    Hello Martin,
    I think there's an issue as I am unable to mark your response as definite answer.
    Passing the temp table buffer as argument parameter has indeed fixed my problem.
    Thanks.
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    Unfortunately, verifying answers often doesn't work.I was able to do it on your behalf; it seems to work better (but far from perfect) for moderators.

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
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans