Skip to main content

Num - script and chart function

Num() formats a number, that is it converts the numeric value of the input to display text 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(number[, 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 numeric value of the input expression and generates a string representing the number.

Arguments:   

Num arguments
Argument Description
number

The number to be formatted.

format

String specifying how the resulting string is to be formatted. If omitted, the decimal and thousand separators that are set in the data load script are used.

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.

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.

Example:  

The following table shows the results when field A equals 35648.312.

Results
A Result
Num(A) 35648.312 (depends on environment variables in script)
Num(A, '0.0', '.') 35648.3
Num(A, '0,00', ',') 35648,31
Num(A, '#,##0.0', '.', ',') 35,648.3
Num(A, '# ##0', ',', ' ') 35 648

Example:  

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.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com