printing selected row
gmorken
Member Posts: 38
Hello,
I have a report (picking list) which prints out all rows on the picking list. But if I want to print just a single row on the picking list. For example, I just want to print the row which is currently selected/highlighted. Can this be done?
Regards
Tomas
I have a report (picking list) which prints out all rows on the picking list. But if I want to print just a single row on the picking list. For example, I just want to print the row which is currently selected/highlighted. Can this be done?
Regards
Tomas
0
Comments
-
Hello Tomas,
If your "selection/highlight" is a field in the line table and you have that rec available to be filtered on your report request form then you can always place a filter and enable only the recs you want...
If not, then what do you mean by "selected/highlighted"? the user has selected a few recs in the lines of a pcking list and wants to print only them?
In that case you can run your report thru code but before you can perfomr something line vPLline.SETRECFILTER and then pass it as a parameter on your report run... Than way the record that is used in the report is already filter with the selected recs...
I hope this helps a bit...
0 -
I only want to print the lines which the user has selected.
What do you mean vPLine.SETRECFILTER? Can you show me with an example?
Regards Tomas0 -
Oops, wrong function... #-o
I meant SETSELECTIONFILTER. I copy/paste from C/SIDE help:SETSELECTIONFILTER (Form)
Use this function to have the system note the records the user has selected on the form, mark those records in the table specified, and set the filter to "marked only".
CurrForm.SETSELECTIONFILTER(Record)
Record
Data type: record
A specific record or records.
Comments
If either all or no records are selected, marks will not be used.
Then in your code you can copy that rec of the form to another record variable and pass it as a parameter to a REPORT.RUN, i.e. a report that has a list of customers and runs a report for the selected customers only:CurrForm.SETSELECTIONFILTER(Rec);
Customer.COPY(Rec);
REPORT.RUN(REPORT::"An Example Report",FALSE,FALSE,Customer);0 -
ok! I will try this. thx for the help
// Tomas0 -
I haven't tried that specific code... It is a sample...
You can also look at the Posted Purchase Receipt Form in the OnPush of the Print button which does a similar thing:CurrForm.SETSELECTIONFILTER(PurchRcptHeader); PurchRcptHeader.PrintRecords(TRUE);
and the printrecords procedure of the Return Receipt Header table follows:PrintRecords(ShowRequestForm : Boolean) WITH ReturnRcptHeader DO BEGIN COPY(Rec); ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Ret.Rcpt."); ReportSelection.SETFILTER("Report ID",'<>0'); ReportSelection.FIND('-'); REPEAT REPORT.RUNMODAL(ReportSelection."Report ID",ShowRequestForm,FALSE,ReturnRcptHeader); UNTIL ReportSelection.NEXT = 0; END;It is a little more complicated, but you can see how it works...
0 -
Arhontis, please help me understand the navision code above:Arhontis wrote:PrintRecords(ShowRequestForm : Boolean) WITH ReturnRcptHeader DO BEGIN COPY(Rec); ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Ret.Rcpt."); ReportSelection.SETFILTER("Report ID",'<>0'); ReportSelection.FIND('-'); REPEAT REPORT.RUNMODAL(ReportSelection."Report ID",ShowRequestForm,FALSE,ReturnRcptHeader); UNTIL ReportSelection.NEXT = 0; END;
why calling REPORT.RUNMODAL with ReturnRcptHeader instead of with Rec variable directly?0 -
Hello,
You perfrom the:CurrForm.SETSELECTIONFILTER(PurchRcptHeader);
To make the PurchRcptHeader to be filtered with the records that the user has selected on the form, and then call the report to run with that filtered variable (PurchRcptHeader) to display the recs that are within the filter...
You could always use the Rec variable instead of the additional variable (PurchRcptHeader) but that way the form will be filterd also and you will see (on the form) only the filtered records.
By using the addiiton variable you leave the Rec record unfiltered and you filter the PurchRcptHeader... So the only code you actually need (but with your own vatiable, like the picking list line) is:CurrForm.SETSELECTIONFILTER(PurchRcptHeader); REPORT.RUNMODAL(bla bla,ShowRequestForm,FALSE,ReturnRcptHeader);
I hope it is more clear now...0 -
Hello,
if SETSELECTIONFILTER and REPORT.RUNMODAL commands are in the same object (e.g. form) then yes...I has no doubt that we should use additional variable instead of Rec
BUT my question was why navision default code (i.e. TB 6660 PrintRecords() ) has to use additional variable?
IMO the Rec var inside PrintRecords is already pointing to filtered records from calling object (form) so using it directly with REPORT.RUNMODAL will not affect records displayed on the form.
I hope you can explain more...0 -
Hi,
The "PrintRecords" procedure exists in many header tables, almost in all the posted...
Each procedure is almost alike the others, others have a parameter and called with that parameter, others use an additional var (like the question you asked)...
Some of them are also buggy and need modification to work properly...
That local variable in the procedure is not nessecary, if you check other PrintRecords procedures there is not there... and others have parameters...
Remember "If you see it in standard navision code it is not nessecary to be correct..."!!!
Have you solved your earlier issue about printing the user selected recs? :?:0
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
