Options

Report - Item Picture

rico1931rico1931 Member Posts: 295
edited 2010-12-27 in NAV Three Tier
Hi Folks,

New guy here and trying to get my Nav set up for my company.

I currently have a report that works exactly the way I want in classic. Now its time to make it work in the RTC... I read a lot of people saying don't do the "layout suggest" <--since it's a complicated invoice report .. and did it from scratch..

The problem in RTC is that my Item image is no displaying. I set the visibility (in classic as "Yes" and RTC Hidden as False).

The variables are all there and working in classic but for some reason when I insert the picture variable into the RTC it shows up with a red "X" (attached image) .

Would any one have any clue what I am doing wrong?
-rico1931

Answers

  • Options
    ara3nara3n Member Posts: 9,255
    you need to encode the value equal ==Convert.FromBase64String(Code.GetPicture(1))


    and in body section you need to put the hidden text box

    =Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)

    Take a look at std NAV report for examples.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    rico1931rico1931 Member Posts: 295
    Thanks ara2n ... quick question

    in ==Convert.FromBase64String(Code.GetPicture(1))

    do u only need (1) "="

    Also where you state "Code.GetPicture" would Code be something like "Fields!Item_Picture.Value"

    name of the variable is "Item_Picture" for me...or do you really mean "Code.GetPicture"?

    I have been following this blog step by step and it worked find for my company logo but its not working for my Item images in my body.. I have attached a screen shot of the code in the body if someone can take a look and tell me where im going wrong. This is driving me INSANE!

    Thanks again.
    -rico1931
  • Options
    BeliasBelias Member Posts: 2,998
    did you do the CALCFIELDS(picture) in your classic report?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    rico1931rico1931 Member Posts: 295
    Belias wrote:
    did you do the CALCFIELDS(picture) in your classic report?

    Yes sir. I put it in my loop that displays the pictures fine in the classic report. "Item.CALCFIELDS(Picture);"
    -rico1931
  • Options
    BeliasBelias Member Posts: 2,998
    don't call me sir, please...i'm still 23 :mrgreen:
    anyway, try to move the textbox with setpicture in the rdlc designer in the cell above the one with converttobase64
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    rico1931rico1931 Member Posts: 295
    Belias wrote:
    don't call me sir, please...i'm still 23 :mrgreen:
    anyway, try to move the textbox with setpicture in the rdlc designer in the cell above the one with converttobase64
    haha ok sry about that! I'm 23 too! :mrgreen:

    just tried it and nothing.. its weird.. i'm starting to think its my code in classic client but the report looks exactly the way i want it to look in classic..

    I feel also like i'm missing one simple step and i'm just not seeing it.. 3 days at looking at this is really starting to take its toll ](*,)
    -rico1931
  • Options
    BeliasBelias Member Posts: 2,998
    what about the code of setpicture and getpicture functions?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    rico1931rico1931 Member Posts: 295
    Belias wrote:
    what about the code of setpicture and getpicture functions?

    Got it directly from the Blog that I used to set my company logo
    Shared PictureData as Object
    
    Public Function GetPicture() as Object
      Return PictureData
    End Function
    
    Public Function SetPicture(NewData as Object)
      if NewData>""
        PictureData = NewData
    end if
    End Function
    
    -rico1931
  • Options
    rico1931rico1931 Member Posts: 295
    Here is the blog I used to follow the steps

    http://blogs.msdn.com/b/nav/archive/200 ... eport.aspx
    -rico1931
  • Options
    BeliasBelias Member Posts: 2,998
    you've made it wrong: the setpicture mustn't be done on the item_picture, but on the Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)

    basically, you're going to have
    =setpicture(convert.tobase64(item_picture)) //i abbreviated the formula, but i think you understood what i mean
    and put it in the cell above the picture

    the picture instead is OK
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    rico1931rico1931 Member Posts: 295
    Belias wrote:
    you've made it wrong: the setpicture mustn't be done on the item_picture, but on the Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)

    basically, you're going to have
    =setpicture(convert.tobase64(item_picture)) //i abbreviated the formula, but i think you understood what i mean
    and put it in the cell above the picture

    the picture instead is OK

    oh geeze.. I think I know what you mean but I tried changing it and still came up empty handed.. I just want to thank you again Belias for helping me out on this. i know we are close! i'm just so new to this and still reading the books on nav that its getting frustrating.

    Attached I put in a screen shot of what I think you meant in the abbreviated formula.
    -rico1931
  • Options
    rico1931rico1931 Member Posts: 295
    ok now I get what you mean!!! in the attached screen shot and it works!!!!!!!!!!!!!!!!!! THANK YOU!! :D:D:D:D:D:D:D:D:D:D:D:D

    I OWE YOU BIG TIME!
    -rico1931
  • Options
    BeliasBelias Member Posts: 2,998
    [-X
    i meant
    =code.setpicture(Convert.tobase64string(fields!item_picture.Value)) //adjust the upper/lowercase
    just in one textbox!

    because before you wer doing this:
    1. setpicture on item_picture (this saves the value of the item_picture field)
    2. convert the value to base64 (but this gets lost because you don't have saved it)
    3. show the picture through decodifying the UNCODIFIED value you saved with setpicture! <-- big X instead of the pic

    with my formula, you're instead doing
    1. setpicture on the converted value of the item_picture (thus you save the converted value of the picture field)
    2. show the picture through thecodifying the CODIFIED value you saved with setpicture!

    EDIT: ok, you got it :thumbsup: but delete the first cell, it's useless...just maintain the concatenated formula
    you're welcome!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    ara3nara3n Member Posts: 9,255
    you only need setcode and getcode if you are printing in Header section.
    In body section. converting it from string should be sufficient.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    BeliasBelias Member Posts: 2,998
    ara3n wrote:
    you only need setcode and getcode if you are printing in Header section.
    In body section. converting it from string should be sufficient.
    #-o actually, now that you tell it...setting the value of the picture to
    "=Fields!Company_Information_Picture.Value" is enough...no conversion at all is needed.
    i guess that the confersion from string is only needed if you have a textbox in classic layout that refers to the picture field, instead of having a picturebox that refers to the field.
    The conversion process and (as ara3n said) the set/getpicture is only needed when you print the image in header/footer.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    Very Usefull!
    Thanks!

    :P
    ~Rik~
    It works as expected... More or Less...
Sign In or Register to comment.