# Nested numberFormat

**URL:** <https://forum.inductiveautomation.com/t/nested-numberformat/1748>\
**Category:** Ignition\
**Created:** [April 12, 2010, 6:06pm UTC](https://forum.inductiveautomation.com/t/nested-numberformat/1748 "2010-04-12T18:06:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhastie](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@bhastie](https://forum.inductiveautomation.com/u/bhastie)\
**Post date:** [April 12, 2010, 6:06pm UTC](https://forum.inductiveautomation.com/t/nested-numberformat/1748/1 "2010-04-12T18:06:34Z")

</div>

I’m trying to format a number for a mouseover event. If I use numberFormat(22.3456,“0.0”) everything works fine. What I need to do is nest a tag value in the number argument. It would look soemthing like this:  
numberFormat(tag("{FANCOILS/"+{Root Container.contFC\_7\_1.EquipID}+"/Temp}"),“0.0”)

The tag function works fine on its own but returns an unformatted number. Is there a problem with my syntax or is nesting not allowed here?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [April 12, 2010, 6:26pm UTC](https://forum.inductiveautomation.com/t/nested-numberformat/1748/2 "2010-04-12T18:26:29Z")

</div>

Try something like this:

```auto
numberFormat(tag("FANCOILS/"+{Root Container.contFC_7_1.EquipID}+"/Temp"),"0.0")
```

You just had too many squiggly braces - you don’t need them for the string passed into the tag() function.

---

<div class="post-metadata">

**Author:** ![bhastie](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@bhastie](https://forum.inductiveautomation.com/u/bhastie)\
**Post date:** [April 12, 2010, 6:38pm UTC](https://forum.inductiveautomation.com/t/nested-numberformat/1748/3 "2010-04-12T18:38:01Z")

</div>

Here is what I have. I’m not sure where I got the text I sent in the first time.

[code]switch(tag(“FANCOILS/”+{Root Container.contFC\_7\_1.EquipID}+"/STATUS")  
,1,2,3,4,"COOLING ","SATISFIED ","OFFLINE ",“DEFROSTING “,””)

- numberFormat(tag(“FANCOILS/”+{Root Container.contFC\_7\_1.EquipID}+"/Temp"),“0.0”) + " °F"[/code]

This includes the entire expression.

I get a Type mismatch: Argument 0 for the function numberFormat(number,pattern) is an invalid type.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [April 12, 2010, 7:03pm UTC](https://forum.inductiveautomation.com/t/nested-numberformat/1748/4 "2010-04-12T19:03:32Z")

</div>

What is the type of that tag? You can try casting it to a double like this:

`switch(
   tag("FANCOILS/"+{Root Container.contFC_7_1.EquipID}+"/STATUS"),
   1,2,3,4,
   "COOLING ","SATISFIED ","OFFLINE ","DEFROSTING ",""
) +
numberFormat(
   toDouble(tag("FANCOILS/"+{Root Container.contFC_7_1.EquipID}+"/Temp")),
   "0.0"
) +
" °F"`

---

<div class="post-metadata">

**Author:** ![bhastie](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@bhastie](https://forum.inductiveautomation.com/u/bhastie)\
**Post date:** [April 12, 2010, 7:10pm UTC](https://forum.inductiveautomation.com/t/nested-numberformat/1748/5 "2010-04-12T19:10:21Z")

</div>

That’s the ticket 😃

Thanks for the bailout.
