Conversion Functions¶
- Asc
- Base64DecodeText
- Base64EncodeBinary
- Base64EncodeFile
- Base64EncodeText
- CBool
- CByte
- CCur
- CDate
- CDbl
- Chr
- ChrW
- CInt
- CLng
- CSng
- CStr
- Hex
- IsNumeric
- Oct
Asc¶
Returns the number code of a character.
Syntax
Arguments
- string
- The character to return the number code for. If the string holds more than one character, the function returns the code of the first and ignores the rest.
Base64DecodeText¶
Decodes text encoded in Base64.
Webservice integrations often use it to decode a Base64 value that a service returns.
Syntax
Arguments
- value
- The Base64 encoded value.
Base64EncodeBinary¶
Base64 encodes a binary value, such as an image (png, jpg, gif) or a document (pdf).
Webservice integrations often use it when a service requires a Base64 value in the data you post.
Use it with the WebserviceGetBinary Function to encode that function's result in a usable form.
Syntax
Arguments
- value
- The binary value.
Base64EncodeFile¶
Base64 encodes the contents of a file.
Webservice integrations often use it when a service requires a Base64 value in the data you post.
You can use it to upload images to a webservice that requires them Base64 encoded, such as the Shopify Product Image upload.
Syntax
Arguments
-
filesystem
- Optional. The Id of a File System setup. The function resolves the path against that setup rather than the IMan server's own disk. See Naming a file system.
-
file
- The path to the file.
-
throwonerror
- Optional. When False, the function returns an empty string in place of raising an error if it cannot open or read the file. Once you name a file system, this argument is no longer optional. The function uses the number of arguments to decide which form you mean, so a read through a file system must pass all three.
Example
' IMan-specific. Reads a file and returns its Base64
' encoding. The second argument is throwOnError: leave
' it False and an unreadable file yields an empty
' string, so the integration continues.
Base64EncodeFile("C:\IMan\Outbound\SO-10432.pdf", False)
' A File System setup can be named FIRST, in which case
' the path is resolved through it -- Azure Blob, OneDrive
' or S3 -- rather than against the IMan server's own
' filesystem. The container comes from the setup, and
' throwOnError has to be given.
Base64EncodeFile("AZUREBLOB", "outbound/SO-10432.pdf", True)
Base64EncodeText¶
Base64 encodes a textual value.
Webservice integrations often use it when a service requires a Base64 value in the data you post.
Syntax
Arguments
- value
- The textual value.
CBool¶
Converts a value to a Boolean.
Syntax
Arguments
- expression
- Any valid expression. If expression is zero, CBool returns False; otherwise it returns True. If expression cannot be interpreted as a number, a run-time error occurs.
CByte¶
Converts a value to a byte, that is, a number between 0 and 255.
CByte converts any data type to the Byte subtype. For example, CByte forces byte arithmetic when currency, single-precision, double-precision, or integer arithmetic would normally occur.
CByte follows your system's locale setting, and recognises the decimal and thousand separators that locale uses.
Syntax
Arguments
- expression
- Any valid expression. If expression lies outside the acceptable range for the byte subtype, an error occurs.
CCur¶
CCur converts any data type to the Currency subtype. For example, CCur forces currency arithmetic when integer arithmetic would normally occur.
CCur follows your system's locale setting, and recognises the decimal and thousand separators that locale uses.
Description
Returns an expression that has been converted to a Variant of subtype Currency.
Syntax
Arguments
- expression
- Any valid expression.
CDate¶
Use the IsDate function to check whether a value can be converted to a date or time. CDate recognises date literals and time literals, and some numbers that fall within the range of acceptable dates. When CDate converts a number, the whole-number part becomes the date and any fractional part becomes a time of day, counted from midnight.
CDate reads date formats according to your system's locale setting. If a date is in a format the locale does not recognise, CDate may get the order of day, month and year wrong. CDate does not recognise a long date format that includes the day of the week.
Description
Returns an expression that has been converted to a Variant of subtype Date.
Syntax
Arguments
- date
- Any valid date expression.
CDbl¶
CDbl converts any data type to the Double subtype. For example, CDbl forces double-precision arithmetic when currency or integer arithmetic would normally occur.
CDbl follows your system's locale setting, and recognises the decimal and thousand separators that locale uses.
Description
Returns an expression that has been converted to a Variant of subtype Double.
Syntax
Arguments
- expression
- Any valid expression.
Chr¶
Description
Returns the character for a number code.
Syntax
Arguments
- number_code
- The number of the character to return.
ChrW¶
Description
Returns the Unicode character for a number code.
Some Unicode characters are hard to type or display, and some are invisible. ChrW returns any Unicode character from its decimal value.
Syntax
Arguments
- number_code
- The Unicode decimal number of the character to return.
CInt¶
CInt converts any other data type to the Integer subtype. For example, CInt forces integer arithmetic when currency, single-precision, or double-precision arithmetic would normally occur.
CInt follows your system's locale setting, and recognises the decimal and thousand separators that locale uses.
If expression lies outside the acceptable range for the Integer subtype, an error occurs.
Description
Returns an expression that has been converted to a Variant of subtype Integer.
Syntax
Arguments
- expression
- Any valid expression.
CLng¶
CLng converts any data type to the Long subtype. For example, CLng forces integer arithmetic when currency, single-precision, or double-precision arithmetic would normally occur.
CLng follows your system's locale setting, and recognises the decimal and thousand separators that locale uses.
If expression lies outside the acceptable range for the Long subtype, an error occurs.
Description
Returns an expression that has been converted to a Variant of subtype Long.
Syntax
Arguments
- expression
- Any valid expression.
CSng¶
CSng converts any data type to the Single subtype. For example, CSng forces single-precision arithmetic when currency or integer arithmetic would normally occur.
CSng follows your system's locale setting, and recognises the decimal and thousand separators that locale uses.
If expression lies outside the acceptable range for the Single subtype, an error occurs.
Description
Returns an expression that has been converted to a Variant of subtype Single.
Syntax
Arguments
- expression
- Any valid expression.
CStr¶
CStr converts any data type to the String subtype.
CStr follows your system's locale setting, and recognises the decimal separator that locale uses.
What CStr returns depends on the data in expression:
Description
Returns an expression that has been converted to a Variant of subtype String.
- Boolean
- A String containing True or False.
- Date
- A String containing a date in the short-date format of your system.
- Null
- A run-time error.
- Empty
- A zero-length String ("").
- Error
- A String containing the word Error followed by the error number.
- Other numeric
- A String containing the number.
Syntax
Arguments
- expression
- Any valid expression.
Hex¶
Description
Returns a string representing the hexadecimal value of a number.
Syntax
Arguments
- number
- Any valid expression. If number is not a whole number, Hex first rounds it to the nearest whole number.
IsNumeric¶
Description
Returns a Boolean value indicating whether an expression can be evaluated as a number.
Syntax
Arguments
- expression
- Any valid expression.
Oct¶
Description
Returns a string representing the octal value of a number.
Syntax
Arguments
- number
- Any valid expression. If number is not already a whole number, Oct first rounds it to the nearest whole number.