Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Problem saving data from table buffer to sql table

Posted on by Microsoft Employee

Hi 

Having an issue with above.  I am trying to copy a record from a table to a TEMP table with a new primary key (document id).  Then I'm trying to copy the record back from the TEMP table to the original table, only with a new document ID.  sort of like copying an SOP order....  code is below, can anyone tell me what I'm doing wrong or if there is a better way I should be approaching this?  I can see the data in the table buffer when I run the code, but the code won't create the new record for me in the SQL database....Thanks in advance! Aaron

set 'Document ID' of table ONE to 'Document ID';
get table ONE;
if err() = OKAY then
 
      {create the TEMP table}
      set 'Document ID' of table ONE_TEMP to 'Document ID' {this is the new document id}
      release table ONE_TEMP;
      change table ONE_TEMP by ONE_TEMP_KEY1;
      if err() = OKAY then
            copy from table ONE to table ONE_TEMP;
            save table ONE_TEMP;
      end if;

end if;

{create the new record in the table and copy from temp}
set 'Document ID' of table ONE to 'Document ID' {new Document ID}
release table ONE;
change table ONE by ONE_KEY1;
if err() = OKAY then
      copy from table ONE_TEMP to table ONE;
      save table ONE;
end if;

 

*This post is locked for comments

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans