Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
OmuniBasav
Contributor III
Contributor III

How to Number format with Comma Separator in Qlik Application Automation

Hi All, 

I am pulling variable value by using Get Expression Value, and then Storing that in a variable. Its all working fine, but I'm unable to format the number with ',' separator. 

current numbers being displayed as: 5487398

How i want it to display : 54,87,398

I tried to look for the solution could not find any. Please help. 

Labels (1)
1 Solution

Accepted Solutions
Shai_E
Support
Support

Hello, 

I do not think that there is an out of box formula for this in QAA, but i might be wrong.

What you can do is set up a "Custom Code" block, set it to node as the preferred language and add the following code as input:

let number = 5487398;

// US system en-US
let usFormatNumber = number.toLocaleString('en-US');
console.log(usFormatNumber ); // 5,487,398

 

This will parse the number to a local string based on a locale parameter.

The position of the comma can be changed by different locales like the 'en-US' separates numbers with a comma at every 3 digits while 'hi-IN' uses a comma at every 2 digits (the last 3 digits are not separated).

View solution in original post

3 Replies
Shai_E
Support
Support

Hello, 

I do not think that there is an out of box formula for this in QAA, but i might be wrong.

What you can do is set up a "Custom Code" block, set it to node as the preferred language and add the following code as input:

let number = 5487398;

// US system en-US
let usFormatNumber = number.toLocaleString('en-US');
console.log(usFormatNumber ); // 5,487,398

 

This will parse the number to a local string based on a locale parameter.

The position of the comma can be changed by different locales like the 'en-US' separates numbers with a comma at every 3 digits while 'hi-IN' uses a comma at every 2 digits (the last 3 digits are not separated).

OmuniBasav
Contributor III
Contributor III
Author

Thank you @Shai_E I will try this out and let you know the results. 

OmuniBasav
Contributor III
Contributor III
Author

@Shai_E I have tried your method it worked. Thank you so much. Below is how I am storing the variable value from Qlik Sense app, then using custom code to format numbers, then using the store variable value to send it over slack. Thanks again. 

 

slack_numberformat_success.PNG