passing parameters to report - Analysis Report
kmkaot
Member Posts: 261
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
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
-
Function SetParams probably exists in report. You have to copy function parameters to global vars in this function and use these vars in report where you need. I don't know recommend you more precice because I don't know your requirements.0
-
I am planning to keep this report Job queue. In frequential period, it will run the report and send to the user in the email. So Date Frequency is dynamic i.e one month for example 01-oct-17 to 31-10-17.
0 -
Hi Kris
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.
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Please help me with the following code where is the mistake
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 Text0 -
ServerFileName := C419.ServerTempFileName('.pdf'); ClientFileName := C419.ClientTempFileName('.pdf'); // I'd guess that you would want to save the report into the pdf file first... anayreport.SAVEASPDF(ServerFileName) ; // ...and download it after .. C419.DownloadToFile(ServerFileName , ClientFileName); //...and clean after yourself ERASE(ServerFileName); //later Mail.NewMessage(...ClientFileName , TRUE); ERASE(ClientFileName); //...and clean this one tooSlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
My problem is how to pass parameters and Filters .
I am getting this error
Specify a filter for the Date Filter field in the Analysis Line table.
0 -
Good to know, you know.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 ofanayreport.SAVEASPDF(Tofile) ;
you should useanayreport.USEREQUESTPAGE(TRUE); anayreport.RUN
oranayreport.USEREQUESTPAGE(TRUE); anayreport.RUNMODAL
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
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
hI Slawek,
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
KRIS0 -
Job Queue will not work with Outlook based emailing. You need to changew your code to use SMTP mail codeunit, and update bits and pieces, like the pdf file downloading, as the SMPT emailing works on the server side and needs the attachment file to be available on the NSTSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Yes this is right. I will change code as you said
Thanks0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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
