Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Form DataSource data loss

Posted on by Microsoft Employee

Hello,

I've been working on Microsoft Dynamics AX 2012 for a full month now and I encounter strange bug. I've created a table which is set as a DataSource for the form which was also created by me. I add some data from form to table with the command button (Command: New), it saves most data properly when I check in table later, but sometimes (approximately 1 out of 5 times) it sets the Quantity field (EDT created by me, extends integer) to zero.  The next time I try to create exactly same data to table, it will most likely do the job right (same probability of data loss).

I've tried to delete all data from table and synchronize several times, but it didn't help. I've tried to use debugger as well, but as far as the scope for this variable goes, it shows the right value, then it jumps to some formRun methods, where Quantity variable is not present and when it finishes it may or may not show the right value.

Any suggestions with my problem?

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Form DataSource data loss

    Well, global SQL database synchronization solved the issue, I guess it was one of those bugs which shouldn't even appear in the first place. If anyone see something acting unusual like this, perhaps you'd better try synchronization.

    For the synchronization, you can follow this steps:

    technet.microsoft.com/.../aa548671.aspx

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Form DataSource data loss

    Vilmos,

    Can't say that problem is solved yet, but debugging table methods instead of form methods was a good approach, thanks for the advice.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Form DataSource data loss

    Yes, I have overriden executeQuery to apply queryRange for some sorting, but I don't update any data in this method, so it still doesn't explain data loss.

    This quantity field was added to table after it was set as form data source so now I am just synchronizing whole database, so that it can hypothetically improve the situation.

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Form DataSource data loss

    If you just want to save field values in a table, and you talk about variables, you probably have implemented it incorrectly. You must set the datasource and datafield properties on the form control, which will make it a "bound control". Saving and storing the values will be handled by the AX kernel automatically, correctly - there should be no data loss for sure. You could override the insert and update methods on your table, and put breakpoint on those to debug if you have the correct values on object "this", which will be your current table.

  • Suggested answer
    Faisal Fareed Profile Picture
    Faisal Fareed 10,794 User Group Leader on at
    RE: Form DataSource data loss

    Hi Proofessor,

    Have you overwrite any methods in table or at form's datasource? Inserting records in a table which is being used as a datasource in form does not require any coding unless you really have to put some custom logic e.g. default some values in initValue method. Otherwise it is a very straightforward way without any code.

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