Skip to main content

NAV 2013 and NAV 2013 R2 - Add Image in Report.

Hi all,

Let's see a simple thing today i.e How to add images in Reports in NAV 2013 and Later.

* Below screen shot are from NAV 2013 R2, the steps remain same for NAV 2013 too.

So let's do it in a standard Report, say Report 405 which doesn't contain Company Logo. We will add the Company Image from Company Information Card / Table.



Steps -

1. Keep a Safe copy of Standard Report.

2. Design the Report in Developer Environment of the Report, and do below steps -

a. add a global Variable say CompanyInfo.
b. Write Code to Get The Picture Parameter from Company information.

In this Report Step 1 is already Executed so we can skip adding the variable. Let's add code.

You need to add below Code, On Trigger - Purchase Header - OnAfterGetRecord()  -

CompanyInfo.CalcFields("Picture");



Now lets add the Company Picture in DataSet as shown below.



3. Save the Report.

4. Open the layout of the Report.

5. Let's make some adjustment in Header part so that we have some space to add a image. Once done double click the Image from Toolbox.



6. Here we need to provide some information of the image, below are the values -

GENERAL -
a. Name - CompanyPicture
 * Name Can be based on your requirment.

b. Select the Image Source - Database.
 * We are using the image froma database fields.

c. Use this field - =Convert.ToBase64String(Fields!Company_Picture.Value)
 * Company_Picture is the Name that i have given in above stage which adding in dataset.

d. Use this MIME Type - image/jpeg

SIZE - Fit to Size.



Place the image in the location where you want to place it, as shown below.



Save the Report and try to Run the Report.



I guess we have achieved what we have planned for. I hope you will find the post useful and will share the same with other.

The standard report with image is available in my sky drive, if you want download it from Skydrive Folder.

File Name - Add_Image_Report_V2013R2_Report_405.rar

Regards,
Saurav Dhyani
saurav-nav.blogspot.com

Comments

  1. Hello Saurav, Can you please help me the Image URL from database? I have following sql and want the Image URL field from [Record Link] table.
    SELECT dbo.[CRONUS Canada, Inc_$Purchase Header].[Pay-to Vendor No_], dbo.[CRONUS Canada, Inc_$Purchase Header].[Order Date],
    dbo.[CRONUS Canada, Inc_$Purchase Header].[Posting Date], dbo.[CRONUS Canada, Inc_$Purchase Header].[Location Code], dbo.[CRONUS Canada, Inc_$Purchase Header].[Currency Code],
    dbo.[CRONUS Canada, Inc_$Purchase Header].[Vendor Invoice No_],
    dbo.[CRONUS Canada, Inc_$Purchase Header].[Buy-from Vendor Name], dbo.[CRONUS Canada, Inc_$Purchase Line].No_,
    dbo.[CRONUS Canada, Inc_$Purchase Line].Description, dbo.[CRONUS Canada, Inc_$Purchase Line].Quantity, dbo.[CRONUS Canada, Inc_$Purchase Line].[Unit of Measure], dbo.[CRONUS Canada, Inc_$Purchase Line].[Unit Cost (LCY)], dbo.[CRONUS Canada, Inc_$Purchase Line].Amount,
    dbo.[CRONUS Canada, Inc_$Purchase Line].[Line Discount Amount], dbo.[CRONUS Canada, Inc_$Purchase Line].[Quantity Invoiced],
    dbo.[CRONUS Canada, Inc_$Purchase Line].[Receipt No_]
    FROM dbo.[CRONUS Canada, Inc_$Purchase Header] LEFT OUTER JOIN
    dbo.[CRONUS Canada, Inc_$Purchase Line] ON dbo.[CRONUS Canada, Inc_$Purchase Header].No_ = dbo.[CRONUS Canada, Inc_$Purchase Line].[Document No_] AND
    dbo.[CRONUS Canada, Inc_$Purchase Header].[Document Type] = dbo.[CRONUS Canada, Inc_$Purchase Line].[Document Type]

    Thanks much
    Sandip

    ReplyDelete
    Replies
    1. Hi Sandip,
      Didn't understand your query. Please send me details about what you need on postsaurav@gmail.com

      Delete

Post a Comment

Popular posts from this blog

VIEW SERVER STATE permission on SQL Server?

Hi all, Sometime While trying to Login into a database we face an error message as shown below. --------------------------- Microsoft Dynamics NAV Classic --------------------------- You cannot start Microsoft Dynamics NAV Classic because you do not have the VIEW SERVER STATE permission on SQL Server. Contact your system administrator. --------------------------- OK    ---------------------------

BC 21 and Higher - PowerShell Cmdlet (Replacement of Business Central Administration).

Hi Readers, As discussed in last article about deprecating of Business Central Administration, there are few common actions that we use in administration till Business Central 20. For our on-prem customers, we will still require doing activities. As Microsoft suggest we need to start using PowerShell cmdlet.    Let's see how to do those via PowerShell, or Administration Shell. I will be keep adding commands as you comment to this article.

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing -