Tracing where a Global Variable is being modified

Calico
Member Posts: 31
In NAV 5.0 Employee table I have created a new Global Variable (Boolean). It is set to true by the OnValidate triggers of various fields and in the OnModify trigger, a function is run if it is true. I have tested and it is set correctly by the OnValidate triggers but when it reaches the onModify it is false (No). I know there is nothing setting it to false because it is a new variable I have created. There is no CLEARALL statement in either the table or form code (I have exported them as text and searched. Can anyone suggest how I can track down what is changing it? I have tried changing a field which sets the global to true and then immediately doing a page-down to trigger the OnModify but something is resetting it in between these two functions.
0
Answers
-
Very weird.
I think the best thing you can do is using the debugger and adding a watch on that global to see when it changes.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
I've tried that. I put a break point in a validation routine where the variable is set to TRUE and then change the value of that field on the form. The debugger window starts and I as I step through the code I can see the value of the variable being changed from No to Yes. The debugger then returns me to the form waiting for further input. I pg-down to the next record and am returned to the debugger in the on Modify trigger where the variable has already changed back to No (FALSE)! As you say, very weird. I think I need to look at another way of achieving the same result.0
-
I think i'ts normal. Between the validate and the modify the variables are cleared.
You could add your variable as a field.0 -
Belias - I've checked that. I've also tried changing the name of the variable but the result is the same. kapamarou I have checked and you appear to be right - but why?0
-
Because I think that when you use the Rec variable of the form, at some point it gets reset. It's different than using your record variable like this:
SalesLineVar.VALIDATE("No.");
SalesLineVar.MODIFY(TRUE);
SalesLineVar.FunctionToMessageVariable;
In such a scenario the variable remains.
I think it causes some issues in some cases but somehow I believe it's better that it happens like that.0 -
Thanks for everyone's help.0
-
kapamarou wrote:I think i'ts normal. Between the validate and the modify the variables are cleared.
Correct. The globals are cleared between the OnValidate and the OnModify (just tried it out). BUT the records in a globally declared temptable are NOT cleared! This is the code I tried and it works:OnInsert() tmpLanguage.FINDFIRST; MESSAGE('%1',tmpLanguage.Code);
int - OnValidate() tmpLanguage.Code := 'xyz'; tmpLanguage.INSERT(FALSE); MESSAGE('%1',tmpLanguage.Code);
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
- 322 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