Num - script and chart function
Num() formats an expression numerically in the number format set in the system variables in the load script, or in the operating system, unless a format string is supplied, and optional decimal and thousands separators.
Syntax:
Num(number[, format[, dec_sep [, thou_sep]]])
Return data type: dual
Arguments:
| Argument | Description |
|---|---|
| number |
The number to be formatted. |
| format | String describing how the resulting date string is to be formatted. If omitted, the date format set in the operating system is used. |
| dec_sep | String specifying the decimal number separator. If omitted, the MoneyDecimalSep value set in the load script is used. |
| thou_sep | String specifying the thousands number separator. If omitted, the MoneyThousandSep value set in the load script is used. |
Examples:
The examples below assume the following default settings:
- Number format setting 1: # ##0
- Number format setting 2: #,##0
Example 1:
Num( A, '0.0' )
where
A=35648.375
| Results | Setting 1 | Setting 2 |
|---|---|---|
| String: |
35 648 375 |
35648.375 |
| Number: |
35648375 |
35648.375 |
Example 2:
Num( A, '#,##0.##', '.' , ',' )
where
A=35648
| Results | Setting 1 | Setting 2 |
|---|---|---|
| String: |
35,648.00 |
35,648.00 |
| Number: | 35648 | 35648 |
Example 3:
Num( pi( ), '0,00' )
| Results | Setting 1 | Setting 2 |
|---|---|---|
| String: |
3,14 |
003 |
| Number: |
3.141592653 |
3.141592653 |
Example 4:
Add this example script to your app and run it.
Then build a straight table with Field1 and Field2 as dimensions.
Sheet1:
let result= Num( pi( ), '0,00' );
Load * inline
[Field1; Field2
9; 8,2
1; $(result)
](delimiter is ';');
Field1 contains the values 1 and 9.
Field2 contains the values 3,14 and 8,2.