# Expression addition problem?

**URL:** <https://forum.inductiveautomation.com/t/expression-addition-problem/17195>\
**Category:** Ignition\
**Created:** [March 2, 2018, 2:49pm UTC](https://forum.inductiveautomation.com/t/expression-addition-problem/17195 "2018-03-02T14:49:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [March 2, 2018, 2:49pm UTC](https://forum.inductiveautomation.com/t/expression-addition-problem/17195/1 "2018-03-02T14:49:48Z")

</div>

This should be SUPER easy, but I can’t figure out whats going wrong. here’s my expression.

tag({Site.SiteName}+"/Recycle\_Tank\_LVL/Cfg\_PVEUMin")+ 9

site.SiteName is a string = “Folder1”

the tag in question is a float = 1.25

so … this should be 1.25 + 9 = 10.25  
right?

I’m getting 1.259.

If i remove the “+9” I get 1.25. So it’s finding the tag value, just not adding the 9 correctly?

I’ve tried this a few different ways. If I directly reference the tag, it works. Anything indirect does not.

---

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [March 2, 2018, 2:53pm UTC](https://forum.inductiveautomation.com/t/expression-addition-problem/17195/2 "2018-03-02T14:53:14Z")

</div>

ok I put the whole thing in toFloat() and that worked, but why is tag() returning a string?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 2, 2018, 3:50pm UTC](https://forum.inductiveautomation.com/t/expression-addition-problem/17195/3 "2018-03-02T15:50:06Z")

</div>

The tag() functions returns a generic object as it can’t known ahead of time what datatype your tag is. For a generic object, concatenation is the default ‘+’ operator. You really should avoid the use of the tag() function – it exists for compatibility with legacy applications. Instead, add a custom property of the appropriate datatype (float or double in this case) and use indirect binding to load the desired tag into that property. Then use that property in the +9 expression and all will work.

---

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [March 2, 2018, 3:52pm UTC](https://forum.inductiveautomation.com/t/expression-addition-problem/17195/4 "2018-03-02T15:52:48Z")

</div>

ahhh that makes sense. and yeah I was trying to avoid adding another property. Thanks for the detailed explanation!
