[BUG-11697] Round function not working on tag values in expressions

I might be doing something wrong. I am trying to force 1 decimal place on a value I am displaying on a label in Perspective module. I am using a tag with the float data type.

The tag “[default]Test Float” has a value of 1.23456789

This expression returns 1.23456789
{[default]Test Float}

This expression returns “Error_Configuration”
round({[default]Test Float}, 1)

This expression returns 1.2
round(1.234, 1)

This expression returns “1.23456789”
tag("[default]Test Float")

This expression returns “Error_Configuration”
round(tag("[default]Test Float"), 1)

You might have to cast the tag as a float. Try something like:

round(toFloat(tag("[default]Test Float")), 1)

Weird… it’s already a float but these 2 work.

round(toFloat({[default]Test Float}), 1)

round(toFloat(tag("[default]Test Float")), 1)

Thank you for your help.

Hmm. Does this work without the cast in 7.9?

I don’t have a 7.9 instance to test on currently. I’m not sure. I don’t recall having a problem in the past but most of my Ignition work lately has been with SQL Bridge and alarm notification.

Ok we’ll look into it. Might be a bug.

1 Like

Yep, we’re already tracking this one. It’s not just the round function, it’s a more general problem in expressions.

1 Like

For further clarification (and to track all of the Expression issues in one thread), the Expression with problems we are aware of are:

  • Aggregates > maxDate & minDate
  • All Database functions
  • All Store and Forward functions
  • Logic > coalesce
  • Logic > hasChanged
  • Math > pow
  • Math > round
  • String > split
1 Like

Excellent, thank you.

At least we have a work around.

There’s a fair number of places I’ve had to use toInt() with integer constants.

Removing the type restrictions on expressions (and just attempting to coerce in all cases) is on the roadmap.

1 Like

This issue was fixed in the build that was uploaded today (3/12). Please let us know if you continue to see this behavior after upgrading.

Will do.

Thank you.

Oh, I need to type 20 characters to post.

1 Like