Al: Suggestion: Convert to base64

Created on 23 Jun 2017  路  7Comments  路  Source: microsoft/AL

I work a lot with files/images stored in blob fields. With the lack of .NET support it would be good to have the posibility to convert byte arrays to base64 strings, and the other way around.

A real life example would be:

  • Receive a base64 encoded string from a javascript file drag/drop add-in.
  • Store the file into a blob field.
  • Export the blob to base64 to include it in a REST API call to a 3rd party system.
suggestion

Most helpful comment

All 7 comments

With the June update you can use the FromBase64String and ToBase64String functions from the TempBlob table. This was not possible in previous versions.

In case you are interested, I can provide you with a Codeunit for Base64 encoding / decoding, fully written in AL code, without .Net dependency. Didn't publish it because Microsoft promised to enable the functions in the TempBlob.

That would be much appreciated! I don't like the whole concept of temp tables. Especially not of using a helper table like tempblob.

We have it on our backlog to add Base64 to the Library.

@ajkauffmann I would like the AL code example you created. :)

Sorry guys, I'm quite busy those days and forgot about it. Will try to find some time during the weekend. ;-)
Point is: it was focused on encoding text to base64 because you need that for authentication with web services. So currently it is not supporting binary data (e.g. streams).

Closing this suggestion since FromBase64String and ToBase64String functions from the TempBlob table cover it.

Was this page helpful?
0 / 5 - 0 ratings