Thank you all in advance for the kind of help you all are…
I have created a report in export invoice level. I need to print the current record when I preview the report. When I manually enter the data in the filter options like ‘document type’ or ‘No’, I am able to view that that in print report. However, I want the current order details to populate automatically in the report filter options which then I can print preview.
I know I can not ask for urgent help, and I respect what you say…:-), However, quick reply would be really appreciated and I would be very thank full like always…
A good developer is also good at using “copy-paste”! So take a look in standard NAV who this is done. There are tons of examples.
There are several ways to do this.The key is not just to set the report into your action menus with the simple “RunObject” as this doesn’t allow you to pass any parameters. Instead you must write a few lines of code.
Either creating an “SetPrintRecord” initiate function in the report and call it from your page/form.
Or the most simple way, where you simply call the report with the variable, but this of course requires that the primary record on the report is the one you’re calling the report with.
Thank you for quick reply, I do agree to you however, I am not able to find the code for it. I am new and do not know what could be the code for it. Like I did everything in the past to post to excel but didn’t know to press F9 after all the data item and write the code to create excel sheet in onpost section. Hope you understand. If you can just guide a bit I will try to get it done.
Which method to use really depends on how your report is structured. If the primary table used in the report isn’t the same table as the one on the page you’re calling it from then it doesn’t work. But if it is then it’s quite easy: REPORT.RUN(YourReportNo, TRUE, FALSE, YourRecord);
I tried but could not get “Eventually check codeunit 229 (Document-Print).” I am not able to created variable as report. Does this comes same as as we select data item in global variables. I am using nav 2009 R2
Sorry for tdhe delay, got stuck with other work. Yes, amol you got it correct. I want to show the record on the current form to print and for that I want to have “Document Type” and “No.” these two fields to auto populate in the filter as per the current record user is viewing. Your code though seem promising however, I am not able to implement it properly.
I am not able to create to "Define lrProformaInvoice as Report " I am using “Sales Header” and “Sales Line” date items. Also, where do I write the above code please. and how do I go about it.
Do you want to print report for the record which currently in Form or Page ? for example a user working in sales order no 2001 and he prints that sales order then, in ReqFilterFields should automatically show 2001 ? please refer the screen shot
Please try this write this onPush() of the button,
Create a Recorevariable of the dataitem of report and report variable of the report which you want to run
SalesHeader.RESET;
SalesHeader.SETRANGE(SalesHeader.“Document Type”,SalesHeader.“Document Type”::Order);
SalesHeader.SETRANGE(SalesHeader.“No.”,“No.”);
IF SalesHeader.FINDFIRST THEN
BEGIN
Orderconfirmation.SETTABLEVIEW(SalesHeader);
Orderconfirmation.RUN;
END;
I have create record variable of “Sales Header” as SalesHeader do I need to create Orderconfirmation as report of “Report name I am using”? Also, do I need to do this in report or the form from where I will click preview??
I guess I am just about to get it sorted with your little more help. Thanks a ton for helping.