Qlik Community

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Read about the latest Qlik Community enhancements on the Community News blog!
Showing results for 
Search instead for 
Did you mean: 

How to format a number in extension according to Qlik Formatting Pattern?


I'm just starting with my extensions development studies and have probably a dumb question: how to format a number I'm calculating inside my extension JavaScript code according to qlik formatting pattern?

Here is a very basic thing I need to do. A user of extension inputs a number in properties panel, I'm doing some calculations in the extension code and then I need to show the result, something like this: 


paint: function ( $element, layout ) {
var myNewValue;
myNewValue = 100 + layout.myValue;
var html = "" + myNewValue + ""
$element.html( html );
return qlik.Promise.resolve();



But when I'm creating this html element I want to ask Qlik to format this "myNewValue" with Num()  function. Basically I need the string result of Num( myNewValue, '#,##0.##', '.' , ',' ) 

Am I missing something obvious? I understand that I can get strings from hypercube but how to do the same with my own calculated values?

Labels (2)
1 Reply

It looks like this is what you are looking for.

In short, there is enigmajs model, which you can access from your extension via:


 This model allows you to make calls to QIX Engine API. So in your case you would do:

this.backendApi.model.enigmaModel.app.evaluate(`Num(${myNewValue}, '#,##0.##', '.' , ',' )`)
.then((evalResult) => {
  //do what you need with the evalResult

Hope this helps.