# Formating a numeric field

**URL:** https://discourse.nodered.org/t/formating-a-numeric-field/38998
**Category:** General
**Created:** [12 January 2021 12:04 UTC](https://discourse.nodered.org/t/formating-a-numeric-field/38998 "2021-01-12T12:04:17Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![FatPilot](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fatpilot/32/38329_2.png) [@FatPilot](https://discourse.nodered.org/u/FatPilot)
#### Post date: [12 January 2021 12:04 UTC](https://discourse.nodered.org/t/formating-a-numeric-field/38998/1 "2021-01-12T12:04:18Z")

</div>

Hi everyone,  
I'm trying to format a number to be displayed in a particular format and can't see how to achieve that.

I've looked at [All About the Built-In AngularJS Filters ― Scotch.io](https://scotch.io/tutorials/all-about-the-built-in-angularjs-filters) as referred to in the help section.

Using the dashboard text node "Value format" field, and using {{value | number:1}} hPa which gives the result "1,012.8 hPa" which is correct.

However, the result I want is "1012.8 hPa" which is without the 1000 separation comma.

I know I could convert it to a text field etc. However I am wanting to achieve this by applying some sort of mask eg "9999.9" or "####.#".

I have tried all sorts and am stuck. Does anyone know where can I find more documentation or has anyone have any knowledge please?

Cheers.  
Paul.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [12 January 2021 13:05 UTC](https://discourse.nodered.org/t/formating-a-numeric-field/38998/2 "2021-01-12T13:05:39Z")

</div>

Put a `debug` node on the output of the node feeding the `ui-text` node to show what the data type actually is.i.e.is it a numbr or a string that is comong in (I suspect it is a string)

---

<div class="post-metadata">

### Author: ![FatPilot](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fatpilot/32/38329_2.png) [@FatPilot](https://discourse.nodered.org/u/FatPilot)
#### Post date: [12 January 2021 14:09 UTC](https://discourse.nodered.org/t/formating-a-numeric-field/38998/3 "2021-01-12T14:09:53Z")

</div>

Hi zenofmud,  
It's a number.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/ef54acc5fa75126553208a46b8d2d949cdc4bb57.png)

Cheers.  
Paul.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [16 January 2021 08:34 UTC](https://discourse.nodered.org/t/formating-a-numeric-field/38998/4 "2021-01-16T08:34:22Z")

</div>

Sorry for taking so long to get back to you.  
I did a google search ‘ javascript number to string with mask’ and found several possible solutions. You should check some out

---

<div class="post-metadata">

### Author: ![FatPilot](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fatpilot/32/38329_2.png) [@FatPilot](https://discourse.nodered.org/u/FatPilot)
#### Post date: [16 January 2021 21:08 UTC](https://discourse.nodered.org/t/formating-a-numeric-field/38998/5 "2021-01-16T21:08:40Z")

</div>

Hi zenofmud,  
Thanks for your reply.  
I sorted it by formatting the value before sending it to be displayed.  
It's not the way I wanted to do it, but it'll do.

Cheers.  
Paul.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [17 March 2021 21:08 UTC](https://discourse.nodered.org/t/formating-a-numeric-field/38998/6 "2021-03-17T21:08:45Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
