Error while Printing "OutOfMemoryException"

pruebasExpruebasEx Member Posts: 51
When I'm trying to print a lot of invoices from Posted Sales Invoices (143) (+25 aprox)
I get this error:
3t1i46iei00x.png

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.

Best Answer

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    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
    w0ocw0q8vidr.png

    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:
    tnvqgb6rl29i.png
    and the code to clear the BLOB content after the first detail line has been send:
    xboaumgkya4u.png
    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-03

Answers

  • Wisa123Wisa123 Member Posts: 308
    edited 2017-11-20
    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 Dev
  • pruebasExpruebasEx Member Posts: 51
    Wisa123 wrote: »
    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.

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    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-03
  • pruebasExpruebasEx Member Posts: 51
    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?
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    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
    w0ocw0q8vidr.png

    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:
    tnvqgb6rl29i.png
    and the code to clear the BLOB content after the first detail line has been send:
    xboaumgkya4u.png
    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-03
  • pruebasExpruebasEx Member Posts: 51
    The best workaround IMHO is to not to use RDLC :)

    A 'header' is only repeated once if there is no data item underneath it
    w0ocw0q8vidr.png

    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:
    tnvqgb6rl29i.png
    and the code to clear the BLOB content after the first detail line has been send:
    xboaumgkya4u.png
    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!
Sign In or Register to comment.