When I'm trying to print a lot of invoices from Posted Sales Invoices (143) (+25 aprox)
I get this error:
The report has some pictures and I suppose that the problem was an "OutOfMemoryException" So I decided to remove all the pictures from the report to test if this was the problem. But even with no pictures in the report I get the same error when I try to print +25 invoices.
Answers
This means they are still in the Dataset that is beeing processed.
Whenever we deal with Pictures in NAV, make sure the pictures are as small as possible (while still looking good). So before changing objects, make sure you don't have pictures with really high resolution in there.
Yes, that's true. I'll removed from the dataset.
I have 2 type of pictures.
Some of them are in the header (taken from header dataset)
The other is inserted directly in the layout.
When you have a few data items indented one below another NAV 'flattens' the structure before sending it to the RDLC viewer. In result fields in higher level data items are repeated over and over for every details line
If you have a picture passed in some high level data item it gets repeated all low level rows, creating a massive data stream.
I hope that understanding the source of the problem will help you to find a way around it.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Thanks @Slawek_Guzek ! I remove the problem adding the pictures directly in the Layout, but, I don't like too much this solution...
I understand what you are telling me. But I always thought that the best implementation in RDLC versions for insert some pictures was to put the images into a "header" data item. (which only repeats once).
So...Where is the best place to add pictures into data items?
A 'header' is only repeated once if there is no data item underneath it
On the example above the "Document Type" from SalesHeader 1 will be send only once in the data steam, but the "Sell-to Customer No." field from SalesHeader 2 wil be repeated in the data stream for every SalesLine. The picture in SalesLine coming from global var CompanyInfomation will also be repeated on each line
Using the structure above you ould add your picture in SalesHeader 1 - but this wil result in just having one picture per report printout - good for including company logo, not good if you are priting say Sales Orders and want to include different picture per sales header
If you need to have different pictures per sales header include some code to clear the picture after the 1st line is processed. Someting like this:
and the code to clear the BLOB content after the first detail line has been send:
Then in your report, in RDLC, you need to retrieve your picture from the 1st line using FIRST(CompanyInformation_Picture)
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
This was perfect.
Thanks for yout help!