Print report X times

sarkie83
Member Posts: 22
I am trying to write a report which basilically takes the posted shipment note, and uses the info to print off some box labels. This part is fine, but there is a field which says X no. of packages, and I need to use this to make the report print itself X times.
Up till now i've only created relitively simply reports - so is this possible, and where is a good starting point?
Thanks,
Up till now i've only created relitively simply reports - so is this possible, and where is a good starting point?
Thanks,
0
Answers
-
Look at the structure of the existing Sales or Purchase documents, you have a data item called CopyLoop, this sets the number of copies
DavidAnalyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
Thanks for that! I managed to get the reporting running as I wanted by using the copy loop in one of the other reports.
This report is going to be called from the posted sales shipments form - which is fine - I can get it to run my new object ok.
However, I want it to pass through the SS.No. as the filter value for the report. At present you have to manually enter the number.
There are other reports that pull this info through, but looking at them I can't see how they are grabbing the ss.No.
What am I missing?0 -
Not sure but when I run Code Coverage on the print button (which fills in the ss#)
Look at the sales shipment header - a local funct called PrintrecordsPrintRecords(ShowRequestForm) WITH SalesShptHeader DO BEGIN COPY(Rec); ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Shipment"); ReportSelection.SETFILTER("Report ID",'<>0'); ReportSelection.FIND('-'); REPEAT REPORT.RUNMODAL(ReportSelection."Report ID",ShowRequestForm,FALSE,SalesShptHeader); UNTIL ReportSelection.NEXT = 0; END;
The code on the print button isOnPush() CurrForm.SETSELECTIONFILTER(SalesShptHeader); SalesShptHeader.PrintRecords(TRUE);
perhaps a place to start0 -
I would say that you've almost got it sorted out. You can just apply the filter to the Record set that is being passed through to the report.run function as if you were going to apply filters on the options screen if you run it manually.
PrintRecords(ShowRequestForm) WITH SalesShptHeader DO BEGIN COPY(Rec); ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Shipment"); ReportSelection.SETFILTER("Report ID",'<>0'); ReportSelection.FIND('-'); REPEAT SalesShptHeader.Setrange(<FIELDA>,<VALUE1>); REPORT.RUNMODAL(ReportSelection."Report ID",ShowRequestForm,FALSE,SalesShptHeader); UNTIL ReportSelection.NEXT = 0; END;
(of course you want to set Field A to a real field name and Value 1 to some value or use the setfilter command).
Another option if there are more complex options or values required is to build a function that handles any of that filtering logic in the report itself and just call the report using a local variable.0 -
Cheer guys, it's working exactly how I wanted now! Part of the problem is just knowing where to start.. I added this to the OnPush():
SalesShptHeader.SETRANGE(SalesShptHeader."No.","No."); REPORT.RUNMODAL(REPORT::"Shipment Label",TRUE,FALSE,SalesShptHeader);
Although I didn't realise at first you could get at the OnPush() of a menu item, as it was running from a button at first.
Cheers.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