RDLC Reports and images in Dynamics NAV2013 / NAV2015

Recently came across an issue – NAV Windows Client crashes when report 206 (Sales Invoice) is run on massive number of records. After some investigation I’ve found that middle-tier and windows client consuming huge amount of RAM. Well, the reason was simple – someone put an 4MB image to company information. By design all standard reports (if has image) send the BASE64 representation of image with each dataset line (see Fig. 1). Of course, if we got say 500 records and 4Mb image – this will come to 2gb, which is memory limit for 32bit NAV Windows Client. So no surprise it crashes… Of course, we can use smaller image, which i did, but even 300kb image multiplied by thousands of dataset lines will create issue. And after all – it is just stupid to send static data with every line – nothing stop us to clean-up dataset. So the solition is as per Fig. 2. And result is Fig. 3. So then dataset will have image populated only for first document dataset lines – which will dramatically reduce dataset size and improve report performance.

Dataset2

Fig 1.

codesnippet

Fig. 2

Dataset1

Fig. 3