Global Variable Visibility

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

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    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 Singleton
  • David_SingletonDavid_Singleton Member Posts: 5,479
    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 Singleton
  • mgiffordmgifford Member Posts: 44
    Great thanks, I am trying that now!
  • krikikriki Member, Moderator Posts: 9,110
    [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!


  • matttraxmatttrax Member Posts: 2,309
    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.
Sign In or Register to comment.