How to run Report from Page Trigger in NAV - [with code Example]

Report in NAV could be run by different ways.

If code is written then it exceed propertes.
  1. By specifying report on properties
    1. Go to Page where you want to place report and go to Action Page (CTRL + V + O)
    2. In report section write the Name of report and select properties
    3. Fill the boxes as shown you must fill the RunObject Properties with the name of report to execute with starting Report. ie. Report Report Name
  2.  By Code
    Following are some way of writing code:
    1. To write code go to page action and select action and write code in action trigger
In this example CustReportVariable is Report Local variable which needs to be execute.

Rec.SETRECFILTER;
CLEAR(CustReportVariable);
CustReportVariable.SETTABLEVIEW(Rec);
CustReportVariable.RUNMODAL;

Reference: SETRECFILTER in NAV [Microsoft Official Document]

In this example CustRecord is Customer record Local Variable and CustReportVariable is Report Local variable which needs to be execute.

CustRecord.RESET;
CustRecord := Rec;
CustRecord.SETRANGE("No.","No.");
CustRecord.SETRANGE(...);
CustRecord.SETRECFILTER;

CLEAR(CustReportVariable);
CustReportVariable.SETTABLEVIEW(CustRecord);
CustReportVariable.RUNMODAL;


In this example CustRecord is Customer record Local Variable.

CustRecord.RESET;
CustRecord.SETRANGE("No.","No.");
CustRecord.SETRANGE(...);
REPORT.RUNMODAL(REPORT::"Report Name",TRUE,FALSE,CustRecord);


Post a Comment

Thank you for comment, I really appreciate your view.

–>