Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Form DataSource data loss

(0) ShareShare
ReportReport
Posted on by

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
    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
    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
    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
    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
    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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans