Dynamically choose Invoice logo


One of our client want to print the company logo in sales invoice report depends on sell to customer field dynamically.

I have written code for this and i need know in source exp of picture box how to use IF loop.

for ex IF Customer.Picture <> ‘’ THEN CompanyInfo.Picture ELSE Customer.Picture;

if the customer rec does not have any picture value it should print company information picture… how to define this… am unable to assign BLOG field to any variable please help me on this.

Thanks in advance,

Shyam Kumar N

If you check the standard Invoice report (206) then you can see that it already have CompanyInfo1, CompanyInfo2 and CompanyInfo3.

So you can to do it the same way they are doing it here. Assuming your question is not about a “classic” report (you didn’t write this in your question [:’(] ), then you would be transferring both the customer and the company logo and in RDLC check if the field is empty or not.

Hi Erik

Thanks for your reply,

Sorry its Classic report NAV 4.0 version. my question is for few customers, invoice should generate with separate logo. for other as usual same company information logo. CompanyInfo1, CompanyInfo2 and CompanyInfo3 are used for left, right, center alignment defined in Sales setup. i need to know in same picture box how to separate this. please help me.


Shyam Kumar N

Yes they are used for alignment, but the principles are the same. Only one is shown, based on which one is not empty.

And don’t show it in the same picture box, but use two picture boxes, and then if customer.picture is not blank, then show it, otherwise show the normal company picture.


IF Customer.Picture.HASVALUE THEN

Customer.CALCFIELDS(Picture) ELSE





i have written this code, But its still not work out. Could you know how to use If statement to get the value of BLOB field.


Shyam Kumar N

That looks kinda ok. What you need now is to create to picture boxes (overlaying each other), then only one picture will show.

Use Visible property to show and hide two picture boxes…

Amol, this is classic 4.0, no way to set visible dynamically there.

But if you have two picture boxes, and only one have content, then that’s the only one that will display. The other is just empty.

What trigger are you putting this code?

What is the sourceexp of the picbox?

Do you not need a customer.get to find the correct record?


create a new global variable (temporary=yes):

CompInfoRight | Record | Company Information

open the sections designer.

set the sourceexpr property of e.g. the right picture from CompanyInfo2.Picture to CompInfoRight.Picture.

add following code to the trigger “Sales Invoice Header - OnAfterGetRecord()”:

IF SalesSetup.“Logo Position on Documents” =
SalesSetup.“Logo Position on Documents”::Right THEN BEGIN
customer.GET(“Sell-to Customer No.”);
IF customer.Picture.HASVALUE THEN
CompInfoRight.Picture := customer.Picture;
CompInfoRight.Picture := CompanyInfo2.Picture;

Hi Jonathan,

Clear explanation and it really works fine. thanks for your time and hats off [Y].


Shyam Kumar N