You can use Base64ToBlob in OCL when you need to convert a Base64-encoded string into a byte array (BLOB), for example before making generated text available for download.
Syntax
base64String.Base64ToBlobThe input must be a string that contains Base64 data. The result is a byte array (BLOB).
Convert clear text to a BLOB
If your starting value is clear text, convert the text to Base64 first, then convert the Base64 value to a BLOB:
'My clear text string'.StringToBase64.Base64ToBlobIn this example, StringToBase64 creates the Base64 representation of My clear text string, and Base64ToBlob converts that representation to bytes.
Preserve a required text encoding
A .NET string is Unicode in memory. If the receiving file requires a specific encoding, encode the string before converting it to a BLOB.
For example, this expression encodes self.XML as ISO-8859-1 (code page 28591) and then produces a BLOB:
self.XML.StringToEncodedBase64(28591).Base64ToBlobUse this pattern when an XML declaration specifies ISO-8859-1 and the downloaded file must use that encoding. See ViewModelAsXml for the complete XML-generation example.
Common mistake
Do not apply Base64ToBlob directly to ordinary clear text. First create Base64 text with StringToBase64, or use StringToEncodedBase64 when you must select the output encoding.
