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.
ok I put the whole thing in toFloat() and that worked, but why is tag() returning a string?
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.
2 Likes
ahhh that makes sense. and yeah I was trying to avoid adding another property. Thanks for the detailed explanation!