Error while Printing "OutOfMemoryException"

pruebasEx
Member Posts: 51
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.
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.
0
Best Answer
-
The best workaround IMHO is to not to use RDLC
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)
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-032
Answers
-
I'll guess you only removed the pictures in the layout.
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.Austrian NAV/BC Dev1 -
I'll guess you only removed the pictures in the layout.
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.
0 -
The problem with pictures is a result of the way how the RDLC printing works.
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
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-031 -
Slawek_Guzek wrote: »The problem with pictures is a result of the way how the RDLC printing works.
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
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?0 -
The best workaround IMHO is to not to use RDLC
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)
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-032 -
Slawek_Guzek wrote: »The best workaround IMHO is to not to use RDLC
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)
This was perfect.
Thanks for yout help!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