,
VALUE
)

The radix( function converts a text item containing a number in a radix between 2 and 36 into a decimal number.

Parameters

This function has two parameters:

radix – is the base for the numbering system you are converting from. You may specify any base from 2 to 36, or you can specify the radix as binary (same as 2), octal (same as 8) or hex (short for hexadecimal, same as 16).

value – is a text item that contains the non-decimal number you want to convert.

Description

This function normally returns an integer that contains the decimal (base 10) number corresponding to the number in a radix between 2 and 36 which was input to the function. If there are more digits in an input number than can be converted to an integer within Panorama’s constraints, this function will return a raw binary data value instead of a number. This binary value may be of unlimited length. (Note: Since previous versions of Panorama did not have an explicit binary data type, earlier versions of this function returned the binary data in a text value. You may need to adjust your code accordingly.)

``````radix("hex","100") ☞ 256
``````

Note: The final example converts the hex into binary data, which has then been automatically converted to text. This works fine for 7-bit ASCII, but will not work properly for 8-bit characters. See the binarytotext( amd texttobinary( functions to learn how to handle conversion of binary data to text using different encoding methods.

Error Messages

radix( function error: radix must be from 2–36, or ‘hex’, ‘octal’ or ‘binary’. – Choose a radix between base 2 and base 36.

radix( function error: input number contains illegal digit. – The input value contains an invalid digit. The range of valid digits varies depending on the radix being used. For base 2 (binary) only the digits 0 and 1 are valid, for octal values can be from 0–7, and for hexadecimal (base 16) a digit may be 0–9 or A-F.

• bigendianbinaryvalue( -- converts big endian binary data (a byte, word, or longword) into an unsigned number (see Binary Data).
• Binary Data -- Panorama allows a formula or procedure to work with raw binary data.
• binarydatabuild( -- builds a binary value by scanning a database and assembling individual binary values for every record (including invisible records) in the database.
• binarytotext( -- converts binary data into text, optionally using a specified encoding.
• binaryvalue( -- converts binary data (a byte, word, or longword) into a number (see Binary Data).
• byte( -- converts a number into a single byte of binary data (see Binary Data).
• bytearray( -- extracts a value from an array of bytes (see [Binary Data]).
• bytepattern( -- converts a byte count to text: 543 Bytes, 543 Kb, 123 Mb, 3.2 Gb
• chunkarray( -- extracts a binary "chunk" from binary data (see Binary Data).
• Data Arrays -- A numbered collection of data values.
• Data Dictionaries -- Overview of Panorama's key/value data dictionaries.
• hex( -- converts a text item containing a hexadecimal number into a standard number (decimal).
• hexbyte( -- converts a limited range of decimal numbers to a two-digit hexadecimal number expressed as a text string.
• hexlong( -- converts a decimal number to an eight-digit hexadecimal number expressed as a text string
• hexstr( -- converts a number to text formatted as a hexadecimal number.
• hextobinary( -- converts a sequence of hexadecimal digits into a raw binary data value.
• hexword( -- converts a decimal number to a four-digit hexadecimal number expressed as a text string.
• littleendianbinaryvalue( -- converts little endian binary data (a byte, word, or longword) into an unsigned number (see Binary Data).
• longlongword( -- converts a number into a 64 bit longword (8 bytes) of binary data (see Binary Data).
• longlongwordarray( -- extracts a value from an array of 64 bit longlongwords (see [Binary Data]).
• longword( -- converts a number into a 32 bit longword (4 bytes) of binary data (see Binary Data).
• longwordarray( -- extracts a value from an array of 32 bit longwords (see [Binary Data]).
• radixstr( -- converts a number into a text item containing the equivalent number in a radix between 2 and 36.
• signedbinaryvalue( -- converts binary data (a byte, word, or longword) into a signed number (see Binary Data).
• texttobinary( -- converts text into binary data, optionally using a specified encoding.
• word( -- converts a number into a single word (2 bytes) of binary data (see Binary Data).
• wordarray( -- extracts a value from an array of 16 bit words (see Binary Data).

History

 Version Status Notes 10.0 Updated Carried over from Panorama 6.0, but now supports 64 bit values. If the specified radix is 16 (hex) and there are more than 16 digits supplied, the result will be a binary data value. Previous versions of Panorama would return binary data in a text value if there were more than 8 digits supplied. This function also now supports any base between 2 and 36, not just 2, 4, 8 and 16.