Help Needed
toshitapori
Member Posts: 52
Hey Guys ,
I am new into navision Programming and i am trying to write a codeunit
where it shud turn the modified flag of all the objects whereever it is true to false .
Can anyone suggest me how to do it ?
Thanx In advance
Toshi
I am new into navision Programming and i am trying to write a codeunit
where it shud turn the modified flag of all the objects whereever it is true to false .
Can anyone suggest me how to do it ?
Thanx In advance
Toshi
0
Comments
-
Define a variabled called obj as type record = Object (this is one of those object with a very high ID).
This could be your code....
if obj.find('-') then repeat
if modified = true then begin
obj.modified := false;
obj.modify;
end;
until obj.next = 0;
I would suggest to do it through a report, as it is easier.
Remember if you want to filter on obj where modified = true, and you are modifying the modified field, you should do it by using another variable called obj2 or something and only do obj2.modify.
Reason for this is because you change the field that you are currently filtering on, then you are also stuffing up the filter.
If you don't understand this last paragraph (because you are new), don't worry too much, you will run into that problem (then hopefully you will remember that I mentioned that you should not change the same field that you are filtering on, use a diff variable, set it to the same record then modify the diff variable).
Cheers,
Gus0 -
Sorry, did not mean to post another reply... darn!! no delete button...0
-
Hi Gus ,
I wrote Exactly the same code before and tried but it give the error that you cannot modify table data in Object table and now i have to manually remove the Flag or there is still any another way around0 -
obj.setrange(Type,obj.Type::Table,obj.Type::Codeunit); obj.modifyall(Modified,false);
That's all folks... ;-)0 -
Thanks Kine,
That is the correct way of doing it for this task. I though I'd make it a bit more complicated, but also talking about something that you will run into later (filtering on the field that you modify).
I think you might not have enough permissions in the license file that you are using (or perhaps you picked up the wrong lines, which is why Kine added the filter that you should use).
Let me know if you still have problems with this, but use Kine's code.
Cheers,
Gus0 -
It worked fine now .
Cheers,0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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

