Base64 Conversion Functions
Previously, files had to be converted to Base64 using external libraries before being sent to the backend. The new functions provide built-in Base64 encoding and decoding capabilities, eliminating the need for external dependencies.
Why Base64?
Binary data (such as PDFs or images) can get corrupted when transmitted over text-based protocols. Base64 ensures safe and consistent transfer by converting binary data into a text-based format.
Function: $$EncodeFileToBase64
The function EncodeFileToBase is a new functionality in TallyPrime Release 7.0 that will allow the developers to encode a file in the provided path to base64 string.
This function Returns, Base64 string if successful else empty string.
Syntax
$$EncodeFileToBase64
Example
[Function: EncodeFile]
Variable : InputFilePath : String : “D:\temp\tnc.pdf”
Variable : TargetFilepath : String : “D:\temp\Base64.txt”
000 : Delete File : ##TargetFilepath
110 : Open File : ##TargetFilepath : Text : Write : ASCII
120 : Write File : $$EncodeFileToBase64:##InputFilePath
130 : Close Target File
Function: $$EncodeStrToBase64
The function EncodeStrToBase is a new functionality in TallyPrime Release 7.0 that will allow the developers to encode the string passed to base64 string.
This function Returns, Base64 string if successful else empty string.
Syntax
$$EncodeStrToBase64
Example
[Function: Encodestr]
Variable : StrtoEncode : String : ‘Test String to Encode’
Variable : Base64str : String
100 : Set : Base64str : $$EncodeStrToBase64:##StrtoEncode
110 : Log : ##Base64str
120 : Log : $$DecodeBase64Str:##Base64str
Function: $$DecodeBase64Str
The function DecodeBase64Str is a new functionality in TallyPrime Release 7.0 that will allow the developers to decode a base64 string back to string.
This function Returns, String decoded from passed base64.
Syntax
$$DecodeBase64Str
Example
[Function: Encodestr]
Variable : StrtoEncode : String : ‘Test String to Encode’
Variable : Base64str : String
100 : Set : Base64str : $$EncodeStrToBase64:##StrtoEncode
110 : Log : ##Base64str
120 : Log : $$DecodeBase64Str:##Base64str
