Options

Bitmap on Repeater

BeliasBelias Member Posts: 2,998
edited 2010-08-07 in NAV Three Tier
i don't think this is possible, but i'll ask anyway:
i want to put bitmaps on a repeater control (in classic client we did it with bitmaplist property)

if it's not possible, i'll explain what's the business need:
there is a list of barcodes and each of them can have let's say 4-5 different statuses: the status is very important for the customer and it must be immediately visible to him: how can i do it?the line format is not feasible because it can have only 2 formats, for example green and normal.
:-k while writing i thought about freezing the status column...it can be a solution, but i want to hear from you guys, too :thumbsup:

hope to be clear, thanks in advance
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog

Comments

  • Options
    kinekine Member Posts: 12,562
    I think that you hit the problematic part of RTC - visual flags. I have not seen solution for this yet, but may be just because I never met some. There are way how to bind your own library to the RTC functionality (and I am not talking about addins), but it is hard to use (using the dll files which are in RTC folder). May be it will be a way, but I never tried that. I just know, that it is possible to trigger functions and read data displayed in active page etc.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    BeliasBelias Member Posts: 2,998
    if it's hard for you, i don't think i'll even try to use the dlls you said...besides that, i'm still (slowly) learning c# and i would not be able to do it anyway...well, thanks for the input: today i have a meeting with this customer, and we'll probably talk about this...is so, i'll let you know what will be the solution, thanks!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    Christian_AbelnChristian_Abeln Member, Microsoft Employee Posts: 42
    edited 2010-03-17
    Hi everybody,

    because this "How do I show Bitmaps in a RTC Repeater?" thing came up several times I'd like to post a clarification.

    The RTC can actually show pictures in the repeater, and even many more formats than the classic client! Png with transparency, Gif, Jpg, ...
    This is the proof:

    This is how you do it:
    In the table which the page is bound to, add a field of type BLOB and Subtype Bitmap. Any field on the page that is bound to that field will happily show any picture that is stored in this table field.

    This did not answer your question? - I know :wink:
    You might want to show a picture based on an expression for a table that contains values, and the pictures shall come from a different table that contains all possible state pictures in your application. Actually, something like in the screenshot above.

    :cry: The bad news :
    There is a known bug in NAV 2009 and also SP1, that prevents that Bitmaps for an SourceExpression to another table than the page table are not delivered to a field.

    :) The (little) good news:
    You can work around it. You may maintain all state pictures in a separate bitmap table. But you also need to add a Bitmap BLOB field to the data table that you bind the page with the list to. Now you copy the respective state Bitmap over, from the Bitmap table to the data table. You can do this in the Triggers OnAfterGetRecord() and OnModifyRecord(), the latter if your list is editable.

    To keep performace up, you might want to cache the records for the needed state images in variables on the page, so you do not need to search for the respective state picture in your bitmap table over and over again.

    :D And the better news:
    We will fix this for future releases.

    (You may download sample objects from my Blog Post)
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Christian Abeln
    Program Manager Microsoft
    Dynamics NAV

    blogs.msdn.com/cabeln/
  • Options
    BeliasBelias Member Posts: 2,998
    To keep performace up, you might want to cache the records for the needed state images in page variables
    ehi, good news, thank you!i'll try it out!
    can you explain this more specifically, please?you mean "page variables" or "variables within the page"? (the first one seems strange to me, but to be sure...)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    Christian_AbelnChristian_Abeln Member, Microsoft Employee Posts: 42
    Yes indeed, I mean variables on pages.
    And the AL code for this is really a simple thing.
    Have just put this info also as a post on my Blog for the only purpose of being able to attach a sample object pack. (Which I did not find possible for a forum post.)
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Christian Abeln
    Program Manager Microsoft
    Dynamics NAV

    blogs.msdn.com/cabeln/
  • Options
    BeliasBelias Member Posts: 2,998
    yesterday, i've coded my page in order to show pictures (i crop the faces fro your screenshot :mrgreen: ) and it works fine!
    Today i've seen your code and i've created nearly the same obj as yours. What makes me doubtful is that i've to implement this on a list of about 100000 records: for every record there will be 5 visual flags. With your method i've to copy the biptmaps on every record, isn't it?The underlying table will be largely used in the db...can't this cause performance issues?
    The only solution that comes in my mind, is to use a dedicated table for the list...but this means to duplicate the original data (luckly, PK is only one field)...
    I don't know what is the best option... :?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    Christian_AbelnChristian_Abeln Member, Microsoft Employee Posts: 42
    Great that you have the basics working!
    And you are right, that the flag images MIGHT be commited into the values table in the database - if something asks for posting changes. And this happens, and we clearly do not want picture data in the value table in the database.

    To overcome this issue, I added code into the value table which clears the value for the image in the OnModify and OnInsert trigger.
    When I then opened the value table in classic, I could not observe anymore that picture data get saved into the value table in the database at any time (no '*'s showing). But still the flag pictures show up nicely in RTC.

    (Have updated the sample code.)
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Christian Abeln
    Program Manager Microsoft
    Dynamics NAV

    blogs.msdn.com/cabeln/
  • Options
    BeliasBelias Member Posts: 2,998
    "clear the value in oninsert/modify": good idea! :thumbsup:
    we just need a currpage.update (or just tell the user to press F5 to update the page) in order to have the bitmap updated properly, but not really in the database! \:D/
    Yesterday i tought about a clear loop in the onclose page, but i didn't tried it. Today i tried with your oninsert/modify clear and it works! thank you!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    BeliasBelias Member Posts: 2,998
    Ok, probably i exagerated a bit, here :mrgreen:
    anyway, the performance on this table (2 normal fields + 5 blobs) with 100000 record is good on browsing the list.
    the update is also fast
    the size of the table on the db is less than 3 megabytes
    the result is then pretty good in my opinion, thanks a lot!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    Christian_AbelnChristian_Abeln Member, Microsoft Employee Posts: 42
    Cool! You got it!
    Try using the pictures with transparency...

    (And here a "wast your weekend challenge": Can you make a list of many status pictures that appears from distance as one larger picture?)
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Christian Abeln
    Program Manager Microsoft
    Dynamics NAV

    blogs.msdn.com/cabeln/
  • Options
    mihail_kolevmihail_kolev Member Posts: 379
    Great for use with Option fields :) Very nice :thumbsup:
    -Mihail- [MCTS]
Sign In or Register to comment.