SDK - Apply FormatString to a value

I’m looking for a way to format a decimal tag value by applying the property formatString

tag.getValue().getValue().toString() => too many number after the decimal point
tag.getAttribute(TagProp.FormatString)

Pretty sure we’re just using the DecimalFormat class behind the scenes, so it would be something like this:

formatter = DecimalFormat(tag.getAttribute(TagProp.FormatString))
formatter.format(tag.getValue().getValue())
2 Likes

:+1: Thanks a lot Paul. Exactly what I was looking for.