Skip to content

#018 UNICODE CHARACTERS AS BITMAPS

Whenever we wanted to show a picture either on a CardPart or a ListPart, we used a Blob type field. Now that Blob with SubType Bitmap has become obsolete in Business Central, we have a new type of field for its replacement – the Media type.
Media field works perfectly in a CardPart page, but has some known issues, as for example to appear correctly in a List page. That leaves us with a problem, especially if our clients need for some reason to have an image, logo, or any other type of image in a List.

There is a solution that might help if you face this issue: use Unicode Characters. We can use symbols such as “£∞֍۞?☼?” and although they are text you might find a replacement for your image.

In the following example we will show a simple solution for their usage.

 

Let’s imagine that our client wants to see the stock availability of an item in a faster and simpler way. He asks us to show on the Item page a red, green, or yellow sign if the stock is negative, positive or zero. With the Media type issue, we couldn’t help him, but with the Unicode Characters we can go around it, inclusive with a more performant solution.

First, we have created an extension of the Item table adding a new text field that will receive our Unicode Characters.

codigo1

Then we have created an Enum that has the colors that we want.

codigo2

After this we created a function that returns the Unicode Characters as text.

codigo3

To finish we did a comparison to turn our positive, negative or zero stock into the colors that we wanted to show.

codigo4

As a result, we get our Item page showing the signal colors depending on the stock inventory.

codigo5