Company logo not printing on report

sandmansandman Member Posts: 20
edited 2010-04-01 in Navision Attain
A picture is set in the company information form (which shows up on many reports already).

I declared a global variable called "CompanyInfo" pointing on the "Company Information" record.

Code in the "Report - OnPreReport" trigger:
CompanyInfo.GET;
CompanyInfo.CALCFIELDS(Picture);

I added a Picturebox to the 1st section of my report and it's source expression is set as CompanyInfo.Picture. If it matters, the AutoCalcField is set to "Yes".

Yet, the picture is not showing up on my report....

Am I missing anything?

Answers

  • SavatageSavatage Member Posts: 7,142
    Are you sure the picbox is big enuf?
  • sandmansandman Member Posts: 20
    Yes, I first copied it from another report but, when i saw it wasn't working, I created a new one with the same dimension.
  • Edward_BloomfieldEdward_Bloomfield Member Posts: 155
    Is the rest of the section printing? It may be that there is some code on the OnPreSection of the section header that hides the whole thing?

    Just a guess...
    Edward Bloomfield

    Lead Consultant
    Theta
  • TomasTomas Member Posts: 420
    Is CompanyInfo record used anywhere else?

    You could try adding the code under "OnPreSection" trigger rather than "OnPreReport".
  • DenSterDenSter Member Posts: 8,307
    No, no and no, NEVER write any code like that in any section triggers.

    Make sure that the control is a 'PictureBox', not an 'Image'. Seriously, doublecheck this, go into the property page and verify that it is a PictureBox. Also verify that the SourceExpr is correct. If your "Company Information" record variable is called 'CompanyInformation', then the SourceExpr should be 'CompanyInformation.Picture'. Make sure that the variable name is correct, and that the field reference is correct.

    Then, verify that the AutoCalcField property says '<Yes>' and not 'Yes'. If it doesn't have the '<' and the '>', then delete the value, and it will revert to '<Yes>' automatically. Sometimes, NAV gets confused and thinks that the default '<Yes>' means something different than 'Yes'.
    CompanyInformation.GET;
    CompanyInformation.CALCFIELDS(Picture);
    
    Put that in OnPreReport and it should display the picture.

    If that still doesn't work, then there must be code in your report that clears the CompanyInformation variable. Export the object as text, and do a Find on the variable name.

    One more thing.... make sure that your section actually prints. If you put it into the Body section of a dataitem that has no data, it won't print.
  • sandmansandman Member Posts: 20
    Thanks everyone but THANK YOU Denster!

    Everything was set properly but after exporting the report in a text file I found, on the first data item, another GET on the record variable which, i'm guessing, nullified the CALCFIELDS function on the report section.

    Works now!

    Thanks again
  • DenSterDenSter Member Posts: 8,307
    Cool excellent, good work. You're right, when it refreshes the record, to make the picture appear you'd need to do another CALCFIELD. It can drive a person crazy when you know you've done the right thing and it still doesn't work :mrgreen:
Sign In or Register to comment.