Nav 2013 repeated image in XML dataset solution

CharlehCharleh Member Posts: 44
edited 2014-01-07 in NAV Three Tier
Just a quick tip for anyone struggling with this in case no one has mentioned it

A couple of our clients have moved to 2013, and when running reports off which have many hundreds of rows they were getting a .NET OutOfMemoryException whilst processing the report on the client. It turns out that their company letterhead images were in the range of megabytes (1/2 megs) and due to the way the XML dataset is built on the server the client ends up receiving the image data multiplied by the number of rows in the dataset.

In order to mitigate this, I put a Boolean flag in the report and after the first data item had been built, I then cleared the image column using CLEAR(). This cut the dataset down from several hundred megs to several kilobytes, solving the clients issue.

Code was approx.:
OnAfterGetRecord
  IF NOT LogoLoaded THEN
    LogoLoaded := TRUE
  ELSE
    CLEAR(SomeTable.Picture)
If anyone has a better way to address this, I'd like to know as it doesn't appear to be addressed in the latest NAV build (and I'm not sure how it would be addressed)
Charleh

Comments

  • tinoruijstinoruijs Member Posts: 1,226
    Works great!
    I've implemented it on report 204 Sales Quote;
    IF NOT LogoLoaded THEN BEGIN;
      LogoLoaded := TRUE;
    END ELSE BEGIN;
      CLEAR(CompanyInfo1.Picture);
      CLEAR(CompanyInfo2.Picture);
      CLEAR(CompanyInfo3.Picture);
    END;
    

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • asmilie2basmilie2b Member Posts: 122
    Fantastic Charleh!
    Worked for me too also using the sales quote. We had one quote which had 90 pages and although it previewed after a couple of minutes it would not print, giving an out of memory exception. Now it flies, previewing in less than 5 seconds and prints fine. I think I will use this for all reports going forward that use images.

    Bruce Anderson
Sign In or Register to comment.