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?
0
Comments
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<
Peter
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?
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;
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)
Peter