how to show picture from database in RTC

julkifli33julkifli33 Member Posts: 1,092
edited 2012-05-28 in NAV Three Tier
hi all
i'm using NAV 2009 R2
i want to show company logo,which is uploaded through company information
how to show it in RTC reports at the header?
thanks

Comments

  • julkifli33julkifli33 Member Posts: 1,092
    i already use all the steps
    but why still not working :(
  • julkifli33julkifli33 Member Posts: 1,092
    i try to change this code become visible
    =Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)
    

    but the result is #Error
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    julkifli33 wrote:
    i try to change this code become visible
    =Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)
    

    but the result is #Error

    if it shows "#Error", it means that there's something wrong.
    1. Are you sure you've passed the right value to the function Convet.ToBase64String?
    2. Did you call CalcFields for Picture field?
    ~Rik~
    It works as expected... More or Less...
  • julkifli33julkifli33 Member Posts: 1,092
    julkifli33 wrote:
    i try to change this code become visible
    =Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)
    

    but the result is #Error

    if it shows "#Error", it means that there's something wrong.
    1. Are you sure you've passed the right value to the function Convet.ToBase64String?
    2. Did you call CalcFields for Picture field?

    1. in body... i add textbox. and then the expression i add
    =Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)
    

    2. yes... i add in onPreReport
    CompanyInfo.Calcfields(Picture);
    

    for your information Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)
    --> the bold one in expression is still red underlined
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    julkifli33 wrote:
    [for your information Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)
    --> the bold one in expression is still red underlined

    This is "normal", also if it will show the picture it will remain red underlined.
    Did you try to rewrite code in the textbox that containts convertion? if haven't done yet, try using the assist edit...
    ~Rik~
    It works as expected... More or Less...
  • julkifli33julkifli33 Member Posts: 1,092
    julkifli33 wrote:
    [for your information Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)
    --> the bold one in expression is still red underlined

    This is "normal", also if it will show the picture it will remain red underlined.
    Did you try to rewrite code in the textbox that containts convertion? if haven't done yet, try using the assist edit...
    yes i did it several times

    i attach my steps and result
    please take a look
    what did i miss?
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    All seems correct.
    Could you attach a screenshot of the "About this Report" please?
    The idea I have is that DataSet hasn't the value of the Picture field in the moment you do the convertion.
    ~Rik~
    It works as expected... More or Less...
  • julkifli33julkifli33 Member Posts: 1,092
    All seems correct.
    Could you attach a screenshot of the "About this Report" please?
    The idea I have is that DataSet hasn't the value of the Picture field in the moment you do the convertion.

    what do you mean "About This Report" ?
    in classic mode it showed the picture
    but i added calcfields in section
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    After have launched the report press CTRL+ALT+F1.
    Or use the question mark:
    after this the system will ask you to redo it and then you will see the DataSet.
    but i added calcfields in section

    You said before that you placed calcfields in section... hope not in a section trigger...
    ~Rik~
    It works as expected... More or Less...
  • julkifli33julkifli33 Member Posts: 1,092
    After have launched the report press CTRL+ALT+F1.
    Or use the question mark:
    after this the system will ask you to redo it and then you will see the DataSet.
    but i added calcfields in section

    You said before that you placed calcfields in section... hope not in a section trigger...
    yes i know... in section trigger it doesn't affect the RTC
    i add calcfields twice
    1 in section... (just for testing classic), and another one is in onPreReport

    here the attachment for About This Report
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    This is the problem... As you can see from your screenshot the Companyinfo_Picture hasn't value (otherwise you would see '*' in its column, since it's a BLOB), so when you pass it to convertion function it has nothing to convert.

    In which section you placed the Image in classic report?
    ~Rik~
    It works as expected... More or Less...
  • mihail_kolevmihail_kolev Member Posts: 379
    and don't forget to call CompanyInfo.GET somewhere before the CALCFIELDS :wink:
    -Mihail- [MCTS]
  • julkifli33julkifli33 Member Posts: 1,092
    This is the problem... As you can see from your screenshot the Companyinfo_Picture hasn't value (otherwise you would see '*' in its column, since it's a BLOB), so when you pass it to convertion function it has nothing to convert.

    In which section you placed the Image in classic report?
    I'm modifying purchase order standard (from report no 405)
    and i put the picture box in classic at PageLoop Header (1)
  • julkifli33julkifli33 Member Posts: 1,092
    and don't forget to call CompanyInfo.GET somewhere before the CALCFIELDS :wink:
    yes2... i already have
    Report - OnPreReport()
    CompanyInfo.GET;
    CompanyInfo.CALCFIELDS(Picture);
    
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Make sure that
    CompanyInfo.GET;
    is no where else in triggers which execute after onprereport like dataitems triggers..
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    I suggest you to create a an Header Section for the Purchase Header data Item.
    Put you picture in this section...
    ~Rik~
    It works as expected... More or Less...
  • mihail_kolevmihail_kolev Member Posts: 379
    in classic layout, make sure you use "Picture Box" control, not "Image" (I had that problem before and took me a week or two to notice that)
    -Mihail- [MCTS]
  • julkifli33julkifli33 Member Posts: 1,092
    in classic layout, make sure you use "Picture Box" control, not "Image" (I had that problem before and took me a week or two to notice that)

    yes i already put in picture box
  • julkifli33julkifli33 Member Posts: 1,092
    I suggest you to create a an Header Section for the Purchase Header data Item.
    Put you picture in this section...
    ok i will try...
  • julkifli33julkifli33 Member Posts: 1,092
    i add Companyinfo.calcfields(picture)
    in pageloop dataitem
    now I am able to show in the report
    thanks :)
  • julkifli33julkifli33 Member Posts: 1,092
    Hi ... can i add one more pic from company information?
    i already follow the steps
    but the picture always the same (pic 1 and pic 2 in RS report)
  • Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    julkifli33 wrote:
    Hi ... can i add one more pic from company information?
    i already follow the steps
    but the picture always the same (pic 1 and pic 2 in RS report)
    Have you already trie to take a look to standard "Sales - Invoice" report (ID 206)?
    You will see that there're 3 Logos in the header.
    For each Picture there's a textbox in the body with its "Convert.ToBase64String".
    In the Header there's a "SetPicture" for each Logo, with an increasing number (SetPicture(1,...), SetPicture(2,...) and so on...).
    In the Header each Picture has its own "GetPicture", that calls the corresponding "SetPicture".
    ~Rik~
    It works as expected... More or Less...
Sign In or Register to comment.