# SDK - Apply FormatString to a value

**URL:** <https://forum.inductiveautomation.com/t/sdk-apply-formatstring-to-a-value/15976>\
**Category:** Module Development\
**Created:** [November 13, 2017, 12:02pm UTC](https://forum.inductiveautomation.com/t/sdk-apply-formatstring-to-a-value/15976 "2017-11-13T12:02:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [November 13, 2017, 12:02pm UTC](https://forum.inductiveautomation.com/t/sdk-apply-formatstring-to-a-value/15976/1 "2017-11-13T12:02:43Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 13, 2017, 4:41pm UTC](https://forum.inductiveautomation.com/t/sdk-apply-formatstring-to-a-value/15976/2 "2017-11-13T16:41:07Z")

</div>

Pretty sure we’re just using the [DecimalFormat](https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html) class behind the scenes, so it would be something like this:

```auto
formatter = DecimalFormat(tag.getAttribute(TagProp.FormatString))
formatter.format(tag.getValue().getValue())

```

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [November 13, 2017, 5:09pm UTC](https://forum.inductiveautomation.com/t/sdk-apply-formatstring-to-a-value/15976/3 "2017-11-13T17:09:31Z")

</div>

👍 Thanks a lot Paul. Exactly what I was looking for.
