Pass parameter to report / Setrange two dataitems in report?

ellusivelady
Member Posts: 23
Scenario:-
Report: Sales Order
Data Items: Sales Header, Sales Line
In my Sales Order form, when I click Print Sales Order, above report will be previewed and printed.
This is the coding i use to just pass the Sales Order No. to my report.
I think you all know right that above coding will fill in the value of "No." under Sales Header tab in your request form.
NOW.. what i need is to pass another value "Type" for my dataitem Sales Line in the request form.
Help anyone? I hope my enquiry is explained to your understanding. Thanks.
Report: Sales Order
Data Items: Sales Header, Sales Line
In my Sales Order form, when I click Print Sales Order, above report will be previewed and printed.
This is the coding i use to just pass the Sales Order No. to my report.
SalesHeader.SETRANGE("No.","No."); REPORT.RUN(REPORT::"Sales Order",TRUE,TRUE,SalesHeader);
I think you all know right that above coding will fill in the value of "No." under Sales Header tab in your request form.
NOW.. what i need is to pass another value "Type" for my dataitem Sales Line in the request form.
Help anyone? I hope my enquiry is explained to your understanding. Thanks.
0
Comments
-
SalesHeader.RESET;
SalesHeader.SETRANGE("Document Type", "Document Type");
SalesHeader.SETRANGE("No.","No.");
REPORT.RUNMODAL(REPORT::"Sales Order",TRUE,TRUE,SalesHeader);
Unlike the posted sales invoice table with a key of just "No."
The sales Header Table needs two key
doc type & no.
Not sure I understand passing anything to the sales line table????
if it's a finished report..hopefully the report is built correctly that it shows what you want it to.0 -
Hi,ellusivelady wrote:NOW.. what i need is to pass another value "Type" for my dataitem Sales Line in the request form.
If I understand correctly you want to print only a subset of sales invoice lines filtered by specific value of Type field ?
If so - there is no straight method - you need to modify report and create some function to pass all necessary filters in some C/AL function call prior to running the report. You will also need to use another syntax to run your report (ReportXXX.RUN where ReportXXX is a variable of type of your report).
Regards,
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
You can use a variable for your report. And then you can use the 2 tables, put the filters on them and give them to the report using:
repSomeReport.SETTABLEVIEW(recSalesHeader); repSomeReport.SETTABLEVIEW(recSalesLine);
The Navision-magic makes sure the filters go to the correct dataitem.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:You can use a variable for your report. And then you can use the 2 tables, put the filters on them and give them to the report using:
repSomeReport.SETTABLEVIEW(recSalesHeader); repSomeReport.SETTABLEVIEW(recSalesLine);
The Navision-magic makes sure the filters go to the correct dataitem.
=D>
I didn't know - didn't even try such a solution even when needed something similar.
This should go straight to Tips & Tricks.
Regards,
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Slawek Guzek wrote:This should go straight to Tips & Tricks.
[Topic moved from Navision forum to Navision Tips & Tricks forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
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
- 320 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