Pass value to page

clemboclembo Member Posts: 122
edited 2013-01-21 in NAV Three Tier
I need to open a page and pass to it two parameter.
My problem is that sourcetable's page is temporary record that I create at runtime before open page.
So IF I want open page passing temporary recordset using PAGE.RUN I can pass recordset but cannot call function in page to pass parameter.
There is a way to do it?

Comments

  • krikikriki Member, Moderator Posts: 9,112
    There is!

    Create a singleinstance codeunit in which you have 2 functions:
    -a function that receives a value and puts it in a global variable.
    PROCEDURE SaveParameter(SaveThisParameter AS TEXT))
    TheParameter := SaveThisParameter;
    
    -a function that returns the value of that global variable
    PROCEDURE GetParameter() : ReturnThisParameter AS TEXT
    ReturnThisParameter := TheParameter;
    TheParameter := ''; // clean the global
    

    Before calling your page, call SaveParameter in the singleinstance codeunit.

    In the OnOpenPage-trigger, call function GetParameter in the singleinstance codeunit and save its value in a global in the Page.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • dmytrkdmytrk Member, Microsoft Employee Posts: 10
    Sure singleInstance codeunit is the easiest way if you can only use page.run. But I guess it would work only in single user scenarios.
    The other possibilities:
    * Add parameters to record itself (doesn’t looks nice if parameters belongs to page itself and not to recordset).
    * Create managing table (so caller will pass parameters + userId to this table and other will read it).

    But still, the easiest would be to create page as variable and assign whatever you want to this page. So why not?
    This posting is provided "AS IS" with no warranties, and confers no rights.
Sign In or Register to comment.