How To pass parameters between objects (forms, reports, ...)

AdministratorAdministrator Posts: 2,208Member, Moderator, Administrator
edited 2015-02-20 in How Tos section
How To pass parameters between objects (forms, reports, ...)?

Discuss this How To here.


  • AnonymousAnonymous Posts: 137Guest
    Navision never explains so simply this principe : make function to pass parameters.
  • AnonymousAnonymous Posts: 137Guest
    This how-to is really great for beginners. When I was new in Navision programming world, it took me much time until I discovered how to pass parameters. I think, Navision (ehm, now MBS) should write better documentation for programmers, which should include "cheats" like this; documentation as Application designer's guide is insufficient, because it does not contain basic ideas.
  • sveiverssveivers Posts: 2Member
    I have tried this and I have a Codeunit like this.

    MESSAGE('HER ER før RESULTATET: %1',Comp);
    MESSAGE('RESULT: %1',Comp);

    SetSelskap(Selskap : Text[50])
    Comp := Selskap;
    MESSAGE('Value of Comp: %1',Comp);

    Then I have Form, form1 whch gives a value to Selskap by calling the function Setselskap. The Message(Value of Comp: shows that the value of Comp is set correctly. and Comp is a variable in the Codeunit.

    But at tyhe code( MESSAGE('RESULT',%1',Comp); THE VALUE OF Comp IS LOST

    What is wrong with this code? ](*,)
  • Dorian9003Dorian9003 Posts: 1Member
    Hello to you all!!

    I am trying to pass a parameter from a page to a codeunit function that should start an report with the given parameters in the first place. The problem is that when the parameters are passed to the codeunit, the Record looses the filters. The Variable in the Codeunit is of type "Variant".

    Could anybody give a hint as to why this happends? [-o<
    calling the codeunit.PNG
    function in the codeunit.PNG
  • geordiegeordie Posts: 636Member
    For keeping the filters you need to pass the parameter by reference, ticking the "Var" field in the parameter list of your function.
Sign In or Register to comment.