Global Variable Visibility

mgifford
Member Posts: 44
I have the following code that launches a form:
BoxPalletRec.SETRANGE(SOType,"Source Subtype");
BoxPalletRec.SETRANGE(SONbr,"Source No.");
BoxPalletRec.SETRANGE(SOLine,"Source Line No.");
BoxPalletRec.SETRANGE(ItemNo, "Item No.");
BoxPalletRec.SetShipmentInfo("No.","Line No.");
FORM.RUNMODAL(FORM::"Ship Box", BoxPalletRec);
The line BoxPalletRec.SetShipmentInfo("No.","Line No."); calls a function that sets the value of two global variables...Once the form is loaded and the Validate runs for a specific field I want to access the values of these two global variables within the Validate. For some reason they are empty when the validate runs.
In my mind, the RUNMODAL passed in the BoxPalletRec including the values of the global variables already set. What am I missing?
BoxPalletRec.SETRANGE(SOType,"Source Subtype");
BoxPalletRec.SETRANGE(SONbr,"Source No.");
BoxPalletRec.SETRANGE(SOLine,"Source Line No.");
BoxPalletRec.SETRANGE(ItemNo, "Item No.");
BoxPalletRec.SetShipmentInfo("No.","Line No.");
FORM.RUNMODAL(FORM::"Ship Box", BoxPalletRec);
The line BoxPalletRec.SetShipmentInfo("No.","Line No."); calls a function that sets the value of two global variables...Once the form is loaded and the Validate runs for a specific field I want to access the values of these two global variables within the Validate. For some reason they are empty when the validate runs.
In my mind, the RUNMODAL passed in the BoxPalletRec including the values of the global variables already set. What am I missing?
0
Comments
-
You are doing it the wrong way.
You need to create a variable ShipBox (Form) put the function in there and set the variables.David Singleton0 -
I should say, that you can do it the way you are trying, i.e. calling the form directly, but its a lot more work than creating a variable of type FORM.David Singleton0
-
Great thanks, I am trying that now!0
-
[Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Form variable is definitely the way to go.
In the code you are passing a record variable. When the form loads it retrieves that record from the database. Global variable values are not stored in the database so the form won't know about them.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