RTC filter transfer to Classic Report
Roelof
Member Posts: 377
I'm having an issue with a classic report (report without RDLC), running in RTC. The report is called from a CodeUnit and using a 'MarkedOnly' filter set.
Lot.MARKEDONLY := TRUE;
PrintLotLabel(Lot);
.
.
PrintLotLabel(VAR Lot : Record "Lot No. Information")
REPORT.RUNMODAL(REPORT::"Lot Label",TRUE,FALSE,Lot);
In RTC, the report is losing all it's filters, set by MarkedOnly. I know RTC doesn't like MARKED and MARKEDONLY. Is there an easy workaround to transfer the recordset to the classic report from RTC?
Lot.MARKEDONLY := TRUE;
PrintLotLabel(Lot);
.
.
PrintLotLabel(VAR Lot : Record "Lot No. Information")
REPORT.RUNMODAL(REPORT::"Lot Label",TRUE,FALSE,Lot);
In RTC, the report is losing all it's filters, set by MarkedOnly. I know RTC doesn't like MARKED and MARKEDONLY. Is there an easy workaround to transfer the recordset to the classic report from RTC?
Roelof de Jonghttp://www.wye.com
0
Comments
-
If the number of records is limited and the primary key is a single field, then there is a simple solution.
Build a filter for the primary key like this "<primary key1>|<primary key2>|.."
(Please ensure the primary key field doesn't contain any special filter chars: &, *, |, (, ), ?)
Otherwise I guess you will need to press the magic button "Create Layout Suggestion" [-o<Regards
Peter0 -
Unfortunately that is not the case. The Primary key contains more fields.
Would it be an option to transfer the subset of records (the data record is not large) to the Report using a function on the report? I'm not sure if a Classic Report in RTC likes that but any suggestion here?Roelof de Jonghttp://www.wye.com0 -
Another thing you could try is to insert the records you want into a temporary table variable in the report, instead of pass the marked recordset. (You can set the record to be a temporary table be setting the property temporary = yes.) A new function in the report can be used to insert the records you want from the codeunit into the temp table. For example, your function in the report could be:
InsertRecords(Lot : Record "Lot No. Information")
tmpLot := Lot;
tmpLot.INSERT;
You can then call this function from your codeunit to insert the marked records. The below uses a report variable to call the function created above.
// Lot filtered for marked only already
IF Lot.FINDSET THEN
REPEAT
myreport.InsertRecords(Lot)
UNTIL Lot.NEXT = 0;
In your report you can now use this temp table to loop through the records. With dataitem of type Integer you can use something like the following to go through the records:
Integer - OnPreDataItem()
SETRANGE(Number,1,tmpLot.COUNT);
Integer - OnAfterGetRecord()
IF Number = 1 THEN
tmpLot.FINDFIRST
ELSE
tmpLot.NEXT;
All the table fields in the report need to point to the tmpLot table, and the data will be shown as normal.
Lastly, you need to run the report from the codeunit using the report variable:
myreport.RUNMODAL;0 -
Roelof wrote:Unfortunately that is not the case. The Primary key contains more fields.
Would it be an option to transfer the subset of records (the data record is not large) to the Report using a function on the report? I'm not sure if a Classic Report in RTC likes that but any suggestion here?
No - that is not possible. You cannot call any functions on old reports, and I am almost sure you cannot call a report with a temporary record either.
You could also create a new field on the table, and stamp a unique value (i.e. a GUID?) in it for the records you wish to print. Than you could set a filter, and cross you fingers that nobody else is trying to print any of the same records at the same time... (don't show the request form, as it will delay the print. Or have the report mark the stamped records in the OnInitReport)Regards
Peter0
Categories
- All Categories
- 75 General
- 75 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions