How to pass parameter from form to a table

flnfflnf Member Posts: 3
i try to do this creating a function in the table and calling this function from the form, but when the table go to the OnInsert, the parameter lose the value passed

Comments

  • jhoekjhoek Member Posts: 216
    Not sure if I understand what you mean. Could you perhaps post a snippet of code to clarify? Thanks! :)
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • flnfflnf Member Posts: 3
    Table 27 Item

    MyFlag Boolean (Global)

    CheckMyFlag(parameter : Boolean)
    MyFlag := parameter;

    Form 30 Item Card

    TableItem Record 27 Item (Global)

    Form - OnNewRecord
    TableItem.CheckMyFlag(TRUE)


    My Problem:
    In form 30 I press F3 to create new Item:

    1) MyFlag have value TRUE inside function CheckMyFlag
    2) MyFlag have value FALSE inside OnInsert() Table 27 Item

    Why MyFlag value change to FALSE???

    Thanks for all
  • kinekine Member Posts: 12,562
    Because you set the flag in TableItem variable (instance) and OnInsert is over Rec variable... (it is another "object" with another "state")...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,307
    When you press F3, Navision creates a new instance of a record, and all internal variables will be initialized. Since the MyFlag variable is a boolean, it will be initialized with its default value of FALSE. If you want to do something with that variable, you will have to write some initialization code in the OnInsert trigger.
Sign In or Register to comment.