Num# - script and chart function
Num#() interprets a text string as a numerical value, that is it converts the input string to a number using the format specified in the second parameter. If the second parameter is omitted, it uses the decimal and thousand separators set in the data load script. Custom decimal and thousand separator symbols are optional parameters.
Syntax:
Num#(text[, format[, dec_sep [, thou_sep ] ] ])
Return data type: dual
The Num#() function returns a dual value with both the string and the numeric value. The function takes the textual representation of the input expression and generates a number. It does not change the format of the number; the output is formatted in the same way as the input.
Argument | Description |
---|---|
text | The text string to be evaluated. |
format |
String specifying the number format used in the first parameter. If omitted, the decimal and thousand separators that are set in the data load script are used.
The Num# function supports many format options for different numeric structures, for example: #,##0: Displays a number without decimal places. #,##0.00: Displays a number with two decimal places. ##0.00%: Displays a number as a percentage with two decimal places. #,##0;(#,##0): Formats negative numbers to appear in parentheses. $#,##0.00: Formats numbers as currency with a $ symbol. 0.00E+0: Displays numbers in scientific notation. |
dec_sep |
String specifying the decimal number separator. If omitted, the value of the variable DecimalSep that is set in the data load script is used.
The Num# function supports many decimal number separator formats, for example: Comma ' , ': For example, $1,000,00 for one thousand dollars. Period ' . ': For example, € 1,000.00. Hyphen ' - ': When used instead of the traditional period or comma for the decimal separator, it shows values like ¥1,000-00. For more information, see DecimalSep. |
thou_sep |
String specifying the thousands number separator. If omitted, the value of the variable ThousandSep that is set in the data load script is used.
The Num# function supports many options for the thousands number separator: Period ' . ': Uses a period for the thousands separator (common in some European formats), displaying as $1.000,00 if combined with a comma decimal separator. Space ' ': Uses a space for the thousands separator, which is common in some European countries. Displays as € 1 000.00. Underscore '_': Uses an underscore for the thousands separator, which is sometimes used in technical or specific regional formats. Displays values like $1_000.00. For more information, see ThousandSep. |
Example | Results (String value returned) |
---|---|
Num#( '35,648.31', '#', '.' , ',' ) | Returns string of 35,648.31 and numeric value of 35648.31. |
Num#( ‘35 648.312’, '#', '.' , ',' ) | Returns string of35 648.312 and numeric value of 35648.312. |
Num#( '35.648,3123', '#', '.' , ',' ) | Returns string of 35.648,3123 and numeric value of NULL (-). |
Num#( '35 648,31234', '#', '.' , ',' ) | Returns string of 35 648,31234 and numeric value of NULL (-). |
Num#('1,234.56', '#,##0.00') | Returns string of 1,234.56 and numeric value of 1230.45. |
Num#('$1,230.45', '$#,##0.00') | Returns string of $1,230.45 and numeric value of 1234.56. |
Num#('20220315', 'YYYYMMDD') | Returns string of 20220315 and numeric value of 20220315. |