Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Save table not saving

Posted on by Microsoft Employee

I have a custom form I am working on and for some reason when I change a date in that form that is part of the underlying table, then press the save button which executes the copy to table then the save table commands the date change does not appear to be saved. I debugged it and looked at the table buffer, where I saw the change I made populate the buffer.

Why would it not save from the buffer to the table with the save table command.

Here's my code:

  {Copy the record to the table buffer, then save it.}
         copy to table RMCCS_CustomerProfiles;

   // Fields not in the window or in multiple spots need seperate copy
   RMC_PriceListName of table RMCCS_CustomerProfiles = '(L) PriceListNameLOV' of window rmccsCustomerProfile;
     
         clear table RMCCS_Lookups;
         range table RMCCS_Lookups where   physicalname(RMC_LookupDescription of table RMCCS_Lookups) + " = '" + RMC_BillingFreq_Hold + "'  and " +
                                                             physicalname (RMC_LookupType of table RMCCS_Lookups) + " = 'BillFrequency'";
         get first table RMCCS_Lookups;
         RMC_BillFrequencyTypeID of table RMCCS_CustomerProfiles = RMC_LookupID of table RMCCS_Lookups; 
  
         clear table RMCCS_Lookups;
  
         range table RMCCS_Lookups where   physicalname(RMC_LookupDescription of table RMCCS_Lookups) + " = '" + '(L) BillingMethodDesc' + "'  and " +
                                                             physicalname (RMC_LookupType of table RMCCS_Lookups) + " = 'BillingMethod'";
         get first table RMCCS_Lookups;
  
   clear table RMCCS_Lookups;
  
         RMC_BillingMethod of table RMCCS_CustomerProfiles = RMC_LookupCode of table RMCCS_Lookups; 
        
   RMC_TaxCode of table RMCCS_CustomerProfiles = RMC_CS_TaxCode_Hold ;
         RMC_PriceListName of table RMCCS_CustomerProfiles = '(L) PriceListNameLOV' of window rmccsCustomerProfile of form RMCCS_CustomerProfilePT2  ;
      RMC_ProfileType of table RMCCS_CustomerProfiles = 2;
  
  
 
    save table RMCCS_CustomerProfiles;
    release table RMCCS_CustomerProfiles;
    warning ("Changes Saved.");

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Save table not saving

    Marianno:

    Your code says this:

    save table RMCCS_CustomerProfiles;
    if err() <> OKAY then
    throw system exception for table RMCCS_CustomerProfiles;
    else
    release table RMCCS_CustomerProfiles;
    end if;

    would this be an improvement?

    save table RMCCS_CustomerProfiles;
    if err() <> OKAY and err() <> RECORDCHANGED then { or error 30 }
    throw system exception for table RMCCS_CustomerProfiles;
    else
    release table RMCCS_CustomerProfiles;
    end if;
    For my modifications I get emails for save errors.
    Maybe once a month I get an email showing an error 30 passive lock, ALWAYS on SAVEs.
    Which means the code works properly thousands or tens of thousands times.

    I don't think I should be errorring out on passive locks, what do you think?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Save table not saving

    Thanks so much Mariano. Yes that was it. I was using a 'get table' to pull the current data on the form instead of a 'change table'. Works perfectly now.

  • Verified answer
    Mariano Gomez Profile Picture
    Mariano Gomez 26,225 on at
    RE: Save table not saving

    What your code is doing is copying to the table buffer and saving, but you are not really setting the table pointer to the record you are attempting to save. Try this:

    clear table RMCCS_CustomerProfiles;
    'Customer Number' of table RMCCS_CustomerProfiles = 'Customer Number' of window rmccsCustomerProfile;
    change table RMCCS_CustomerProfiles;
    copy to table RMCCS_CustomerProfiles;
    // set all the other fields here. // save the table save table RMCCS_CustomerProfiles; if err() <> OKAY then throw system exception for table RMCCS_CustomerProfiles; else release table RMCCS_CustomerProfiles; end if;


    The other code kind of looks suspect too - the code you are using to retrieve the billing method and billing frequency, but that's another story.

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans