# Gauge: decimal digits and payload with spaces

**URL:** <https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975>\
**Category:** Dashboard\
**Created:** [4 December 2020 05:35 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975 "2020-12-04T05:35:32Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lupin\_III](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lupin_iii/32/67650_2.png) [@Lupin\_III](https://discourse.nodered.org/u/Lupin_III)\
**Post date:** [4 December 2020 05:35 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/1 "2020-12-04T05:35:32Z")

</div>

Hi, I'm using a gouge node and I know that in Value format:

1. is possible manage payload with spaces as msg.payload["what you want"].
2. is possible define decimal digits directly within the value format as {{msg.payload.whatyouwant | number: 2}}

Both work individually, but I would use them togheter. I've tried several combination but it seems not to work

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 December 2020 09:36 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/2 "2020-12-04T09:36:53Z")

</div>

Hi , sorry I'm not quite clear on which doesn't work ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 December 2020 10:45 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/3 "2020-12-04T10:45:44Z")

</div>

I believe that @Lupin_III is trying to use  
`{{msg.payload["what you want"] | number: 2}}`  
which throws the error `"TypeError: Cannot read property '|number:2' of undefined"`.  
This does work ok  
`{{msg.payload["what you want"]}}`  
I also can't find the right syntax to make it work with `|number`

---

<div class="post-metadata">

**Author:** ![Lupin\_III](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lupin_iii/32/67650_2.png) [@Lupin\_III](https://discourse.nodered.org/u/Lupin_III)\
**Post date:** [4 December 2020 12:44 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/4 "2020-12-04T12:44:31Z")

</div>

Yes Colin, exactly.  
I can't either find a solution. Maybe it's not possible.  
If so, how can I replace the spaces with "\_" inside the properties? Since they are quite a lot, I would like to avoid to rename them one by one inside a function node  
Thanks

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 December 2020 13:59 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/5 "2020-12-04T13:59:32Z")

</div>

Correct it's not really possible. either you can use the angular filters with the value {{value | number:2}} - OR - you can use a msg property. Internally they use different code paths.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 December 2020 14:04 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/6 "2020-12-04T14:04:50Z")

</div>

Do you mean that `{{msg.payload.what_you_want |number: 2}}` should not work? It does work, where the value is in that property obviously.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 December 2020 14:08 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/7 "2020-12-04T14:08:30Z")

</div>

oh right so it's the ["something with spaces"] - hmm ok. will look

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 December 2020 15:19 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/8 "2020-12-04T15:19:27Z")

</div>

Ok - fix found and pushed to master - not on npm yet, until next release.

---

<div class="post-metadata">

**Author:** ![Lupin\_III](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lupin_iii/32/67650_2.png) [@Lupin\_III](https://discourse.nodered.org/u/Lupin_III)\
**Post date:** [4 December 2020 15:50 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/9 "2020-12-04T15:50:30Z")

</div>

This works: {{msg.payload.what\_you\_want |number: 2}} (property with no spaces)  
This doesn't work: {{msg.payload["what you want"] |number: 2}} (property with spaces)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 December 2020 10:18 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/10 "2020-12-05T10:18:57Z")

</div>

If you want to try it before the next release of the dashboard, if you go to your `.node-red` folder and run  
`npm install node-red/node-red-dashboard`  
that will install it direct from git. Then restart node-red to start using it.  
When the next version of node-red-dashboard is released I am not sure if updating from Manage Palette will do it, if not then, again from `.node-red` folder run  
`npm remove node-red-dashboard`  
`npm install node-red-dashboard`  
and restart node-red.

---

<div class="post-metadata">

**Author:** ![Lupin\_III](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lupin_iii/32/67650_2.png) [@Lupin\_III](https://discourse.nodered.org/u/Lupin_III)\
**Post date:** [5 December 2020 10:23 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/11 "2020-12-05T10:23:03Z")

</div>

Thanks a lot

---

<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:** [4 January 2021 10:23 UTC](https://discourse.nodered.org/t/gauge-decimal-digits-and-payload-with-spaces/36975/12 "2021-01-04T10:23:04Z")

</div>

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