# Coerce string to double

**URL:** <https://forum.inductiveautomation.com/t/coerce-string-to-double/7498>\
**Category:** Ignition\
**Created:** [October 30, 2013, 4:43pm UTC](https://forum.inductiveautomation.com/t/coerce-string-to-double/7498 "2013-10-30T16:43:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilikebeer](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@ilikebeer](https://forum.inductiveautomation.com/u/ilikebeer)\
**Post date:** [October 30, 2013, 4:43pm UTC](https://forum.inductiveautomation.com/t/coerce-string-to-double/7498/1 "2013-10-30T16:43:07Z")

</div>

Have an expression i am trying to get correct. The tag is a number and the first part, argument, of the expression works fine.

```auto
IF ({Kepware/TCP505/DnI/Peerlink/UNCOILER_1__ FULL YEAR MAINTENANCE} > 330, "330", "0")
```

Its when I try to subtract a value using that tag in the “If true” part that i get a "trying to coerce [string] to double error

```auto
IF ({Kepware/TCP505/DnI/Peerlink/UNCOILER_1 __FULL YEAR MAINTENANCE} > 330, "{Kepware/TCP505/DnI/Peerlink/UNCOILER_1__ FULL YEAR MAINTENANCE}-330", "0")
```

Can someone guide as to what i am doing incorrectly

Thanks

---

<div class="post-metadata">

**Author:** ![Pat](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Pat](https://forum.inductiveautomation.com/u/Pat)\
**Post date:** [October 30, 2013, 5:13pm UTC](https://forum.inductiveautomation.com/t/coerce-string-to-double/7498/2 "2013-10-30T17:13:47Z")

</div>

If you are trying to return a numeric value then try (no quotes)-

```auto
IF ({Kepware/TCP505/DnI/Peerlink/UNCOILER_1 __FULL YEAR MAINTENANCE} > 330, {Kepware/TCP505/DnI/Peerlink/UNCOILER_1__ FULL YEAR MAINTENANCE}-330, 0)
```

If you are trying to return a string then try (convert value to string with toStr())-

```auto
IF ({Kepware/TCP505/DnI/Peerlink/UNCOILER_1__FULL YEAR MAINTENANCE} > 330, toStr({Kepware/TCP505/DnI/Peerlink/UNCOILER_1__ FULL YEAR MAINTENANCE}-330), "0")
```

---

<div class="post-metadata">

**Author:** ![ilikebeer](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@ilikebeer](https://forum.inductiveautomation.com/u/ilikebeer)\
**Post date:** [October 30, 2013, 5:20pm UTC](https://forum.inductiveautomation.com/t/coerce-string-to-double/7498/3 "2013-10-30T17:20:55Z")

</div>

WOW. ![:prayer:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e5a7e3b63facc151ea73e3b45db7bdb3d4bdc316.gif ":prayer:")  
What can i say other than thanks. i was looking for a numeric value.  
Awesome
