Error using UDT parameter as # of decimal places in Round() function

Trying to use UDT parameter (an integer called 'Decimals') as the number of decimal places for a round() function to round to. When I just put in an integer, the code works so I know everything else is fine. Something about the way I'm referencing the UDT parameter seems wrong though. (I've tried adding a toINT(), that did not work). Thanks in advance!

Any ideas? I'll include the code and the error below

Update: It actually works as expected the way it is written, despite the fact that it throws that error...
Just a bug?


Try using the expresson language tag function to see what type is being returned.

Tip: post code rather than pictures of code. That way we can copy it into our answers and modify it rather than type it all out again.

Thanks for the response (and the tip!). That is a helpful troubleshooting function. By using it I found that the tag() function in question is returning a long. But I'm still confused why using toInt() or toInteger() doesn't resolve the error. The expression actually works as expected whether I just use the tag() function or if I use a toInt(tag()) for [decimals] in round(). It just throws that error every time I close or save the Template.

Thanks again!

Just to check my understanding, tag1 produces the integer part of the number as a scaled value, and tag 2 produces the decimal part of the value? if tag1 = 123
...and if tag2 = 3456
...then the expected result is round(123.3456) or 123. Am I understanding this correctly?

Justin, no, the expression is
toStr(round("123.45678", 3))
which should return 123.345.

Ah, I see it now. Thanks

A long datatype is an integer already, so having a decimal is probably the issue. Since you are expecting decimal places, perhaps using the toFloat() conversion would be the correct thing to do in this case:


I'd expect the first tag to already be a float, otherwise there'd be no rounding to do - which looks like is working, despite the error raised.

If entering a constant instead of using a tag value for the decimal part gets rid of the error, then I'm thinking the error comes from the second tag. What are its value and datatype as shown in the tag browser ?