You can use Base64ToString in OCL to decode a Base64-encoded string as UTF-8 text, for example when an external system provides text in Base64 format.
Syntax
base64String->Base64ToStringApply the operator to a string that contains Base64 text. The result is the decoded, human-readable string.
| Expression part | Meaning |
|---|---|
base64String
|
The string containing the Base64-encoded value. |
->Base64ToString
|
Decodes that value and interprets the decoded bytes as UTF-8 text. |
Test the expression in the Debugger
You can verify a Base64 value before using it in a ViewModel expression.
- Open the OCL evaluator in the Debugger.
- Enter a Base64 string literal followed by
->Base64ToString. - Evaluate the expression and inspect the returned text.
'TURyaXZlbiBEZXNpZ25lcg=='->Base64ToStringThis returns:
MDriven Designer
Decode a model attribute
Use the operator on an attribute when that attribute stores Base64 text.
For example, if Customer.Notes contains a Base64-encoded note, evaluate:
self.Notes->Base64ToStringThe result is the original UTF-8 text of the note. Here, self is the current Customer object.
Use with Base64 encoding
Use Base64ToString to reverse a value encoded with StringToBase64. This pairing is useful when you need to send UTF-8 text as Base64 and later read the original text again.
For example, the following encoded value decodes back to the original text:
| Base64 value | Expression | Result |
|---|---|---|
TURyaXZlbiBEZXNpZ25lcg==
|
'TURyaXZlbiBEZXNpZ25lcg=='->Base64ToString
|
MDriven Designer
|
Input requirements
The receiver must contain a Base64-encoded representation of UTF-8 text. Use this operator for text values, not as a substitute for handling binary data.
