Use a value in a Request Page's field
                
                    MelekBoujelbene                
                
                    Member Posts: 17                
            
                        
            
                    Hello,
I want to use a value from a record in a request page's field.

I used a method "SetParam" to transfer the Primary Key to the report in order to select the right record.
This is the code in the Card Page:
This is the code in the Report :
The first Message is giving "0".
The second Message is giving "Set Param . 1".
Why "SetParam" is not working ?
Thanks in advance.
                I want to use a value from a record in a request page's field.

I used a method "SetParam" to transfer the Primary Key to the report in order to select the right record.
This is the code in the Card Page:
                        trigger OnAction();
                        var
                            locCalculLoyerEntete : Record "Calcul Loyer Entete";
                            repDCL01FDL : Report "DCL 01 FDL";
                        begin
                            locCalculLoyerEntete.Reset;
                            locCalculLoyerEntete.SetRange("No.","No.");
                            if locCalculLoyerEntete.FindFirst then
                            begin
                                Clear(repDCL01FDL);
                                repDCL01FDL.SetTableView(locCalculLoyerEntete);
                                repDCL01FDL.setParam("No.");
                                repDCL01FDL.UseRequestPage(true);
                                repDCL01FDL.Run;
                            end;
This is the code in the Report :
   trigger OnInitReport();
    var
    locCalculLoyerEntete : Record "Calcul Loyer Entete";
    begin
        locCalculLoyerEntete.Reset;
        locCalculLoyerEntete.SetRange("No.",iNoDCL);
        if locCalculLoyerEntete.FindFirst then ;
        Message ('%1',locCalculLoyerEntete."No.");
        dButoir:=locCalculLoyerEntete."Date Butoir";
    end;
    
    procedure setParam(pNo:integer)
    begin
        iNoDCL:=pNo;
        Message('Set Param . %1', iNoDCL);
    end;
The first Message is giving "0".
The second Message is giving "Set Param . 1".
Why "SetParam" is not working ?
Thanks in advance.
0                
            Answers
- 
            Try using OnPreReport instead of OnInitReport.The first Message is giving "0".
 The second Message is giving "Set Param . 1".
 this already tells you that OnInit is run well before your value is set.Austrian NAV/BC Dev1
- 
            The solution that I found is to use OnOpenPage of the Request Page.
 I found this schema very useful: 
 1
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
- 323 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
