Modify problem

tobarich
Member Posts: 33
Hi all, I have a report which updates a record from a setup table. This table has only one record and the mentioned report updates only one column of this record.
The problem is that i was doing some test and commented the line that makes table.GET but let the sentence table.MODIFY. After I ran the report the record of the table was blank.
Something like this:
Has anyone suffered this problem before?
Thanks
The problem is that i was doing some test and commented the line that makes table.GET but let the sentence table.MODIFY. After I ran the report the record of the table was blank.
Something like this:
// table.GET -> line commented ... table.column := newvalue; table.MODIFY;
Has anyone suffered this problem before?
Thanks
0
Comments
-
That is weird. I tried it myself and got the same result.
Without a GET or FIND no record should have been retrieved and thus there should be no record to modify.
I assume that MODIFY looks for a record with that primary key if one has not been retrieved. Since the key for most setup tables is a blank column I could potentially see that happening.
This code blanks the record:Setup.MODIFY; MESSAGE('%1', Setup);
This code produces an error because a record does not exist:Setup.Key := 'TEST'; Setup.MODIFY; MESSAGE('%1', Setup);
0 -
Very weird indeed. I would have expected an error saying something like 'record has been changed by another user'.
You should notify MS about it. Probably you hit a bug.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
My question to you is the table variable in your code example a variable or one of the data items on the report? If it's a variable then I would be surprised as I would expect it to fail - as there's no record retrieved yet to modify...however if it's a Data Item then I think it makes sense.
A report is expected to retrieve and loop through all available records in a given data item. So if the code you refer to is in the OnAfterGetRecord of the Data Item then a record has been retrieved then regardless of whether you explicitly issued a get statment a record should have been retrieved.0 -
I did the same thing with a form (without sourcetable!). I defined a global with the setup-record and in the OnOpenForm, I just put MODIFY and the record was changed!Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions