Udostępnij za pośrednictwem


Showing Bitmap flags in the Repeater (!!! Without Add-ins !!!)

I have heard this a number of times: 
"How do I show Bitmaps in a RTC Repeater?" This seems not to work – so can you please make Add-ins work in the Repeater too (so we can make a Picture Add-in for the repeater)?

Therefore I'd like to post a clarification in this Blog (even if this Post then is not about Add-ins).

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

And this screenshot proofs it:
RepeaterWithPictures

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 is not the problem(!)", you might say – Yes, I know icon_wink
You then probably want to show a picture based on an expression for a value column in a data table. Of course the pictures shall come from a different table, that contains all possible state pictures in your application. Actually, something like in the screenshot above. This what others often say is a “KPI”.

icon_cry  The bad news :
There is a known bug in NAV 2009 and also SP1, that prevents that Bitmaps are retrieved for a SourceExpression to another table than the table than the page is bound to.

icon_smile  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 (will probably not be a big issue in many scenarios though).

And another interesting aspect: We clearly do not want state pictures to end up in the value table in the database. For tables with large amounts of rows this increases the database size unnecessary. Therefore we cater in the OnModify and OnInsert trigger of the value table that the picture field gets cleared. 
 

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

 

You will find some sample objects attached to this post.

PS: Of course on can think of many other scenarios where Add-ins in Repeaters indeed would be cool; like automatic updating presence indicators with interaction to start all kinds of communication right out of a column in a contact list. But this is another story.

Christian Abeln
Senior Program Manager
Microsoft DynamicsNAV

BitmapFlagsInTheRepeater.zip

Comments

  • Anonymous
    January 10, 2011
    HiHow do you make this work on a page running on Temporary tables?I cannot do the Add-in - because this is not supported on the repeater and I cannot do this, because it does not work on the temporary tablesBest regardsPoul
  • Anonymous
    January 10, 2011
    Hi againI found the SourceTableIsTemporary property on the page:-)Best regardsPoul
  • Anonymous
    June 18, 2013
    Hello,I know this has been posted a long long time ago, but has the bug already been fixed ? We use the described solution in list pages, but the drawback is that the blobs are retrieved from SQL in seperate statements. So if 30 records are displayed on page this gives 31 SQL statementsBest regards,Andy