Hi,
I want pass parameters and Filters to report - Analysis Report.
Can anybody help me
I have from date and to date for filters
anayreport.SetFilters(NewDateFilter,NewItemBudgetFilter,NewLocationFilter,NewDim1Filter,NewDim2Filter,NewDim3Filter,NewSourceTypeFilter,NewSourceNoFilter)
I have values for Parameter
anayreport.SetParams(NewAnalysisArea,NewReportName,NewLineTemplateName,NewColumnTemplateName)
Will you give me advice
Warm Regards
Kris
0
Answers
You have basically answered yourself.
You already have defined variable anayreport, you call functions anayreport.SetParams(...) and anayreport.SetFilters(...) passing your values.
You may want to call anayreport.SetCalendarSource() as well and pass relevant params too, and possibly anayreport.USEREQUESTPAGE()
After than call anayreport.RUN or anayreport.RUNMODAL(..), or one of anayreport.SAVEAS* functions and NAV will print or save your report.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
kemail:='kneni@hotmail.com';
Tofile := 'dashboard.pdf';
// Paremeters
//
CUSTOMR:=CUSTOMR::Customer;
NewAnalysisArea:=NewAnalysisArea::Sales;
NewReportName:='CUSTSALE';
NewLineTemplateName:='MASOOD';
NewColumnTemplateName:='SALES';
FileName := TEMPORARYPATH + Tofile;
fromdate := CALCDATE ('<CM-2M+1D>', TODAY-180);
todate := CALCDATE('<CM>',CALCDATE('<-CM-1D>',TODAY));
NewDateFilter:=FORMAT(fromdate)+'..'+FORMAT(todate);
MESSAGE(NewDateFilter); ;
anayreport.SetParams(NewAnalysisArea,NewReportName,NewLineTemplateName,NewColumnTemplateName);
anayreport.SetFilters(NewDateFilter,'','','','','',CUSTOMR,'');
Tofile := DownloadToClientFileName(FileName, Tofile);
anayreport.SAVEASPDF(Tofile) ;
MESSAGE('HERE');
// Mail.NewMessage(ToAddresses ,CcAddresses,BccAddresses,Subject,Body,AttachFilename,ShowNewMailDialogOnSend)
Mail.NewMessage(kemail, '' ,'' ,'Purchase Order from Shura' ,Ksub ,Tofile , TRUE);
// << Show Outlook Dialog before sending mail
Mail.Send;
variables
==================
Name DataType Subtype Length
NewDateFilter Text
NewAnalysisArea Option
NewLineTemplateName Text
NewColumnTemplateName Text
CUSTOMR Option
NewReportName Text
kemail Text
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
I am getting this error
Specify a filter for the Date Filter field in the Analysis Line table.
You have passed the fiters / parameters correctly. Unfortunately they are not used until you open the report with the Request Page.
So instead of you should use or
If you want to use SAVEASPDF the report needs to be changed, you need to copy the code (possibly just a part of it) from OnOpenPage trigger into a separate function which would initialise internals vars, like the DateFilter one.
For future - get familiar with the NAV Debugger - it will quickly become your best frind.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
IT IS REALLY FANTASTIC HELP. THANK YOU.
NOW I AM STRUGGLING TO START JOB QUEUE. I PUT THIS CU IN JOB QUEUE.
I AM TRY9NG SEND AUTOMATICALLY
WARM REGARDS
KRIS
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Thanks