# stringFormat error Perspective

**URL:** <https://forum.inductiveautomation.com/t/stringformat-error-perspective/52581>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 1, 2021, 5:52pm UTC](https://forum.inductiveautomation.com/t/stringformat-error-perspective/52581 "2021-11-01T17:52:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![laurie.croteau](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@laurie.croteau](https://forum.inductiveautomation.com/u/laurie.croteau)\
**Post date:** [November 1, 2021, 5:52pm UTC](https://forum.inductiveautomation.com/t/stringformat-error-perspective/52581/1 "2021-11-01T17:52:13Z")

</div>

Hi,  
I want to copy my labels into an email and I want to transfer integer into string, so I used stringFormat. However, I have this error:

```auto
Error running property change script on NumericEntryField.props.value: NameError: global name 'stringFormat' is not defined

```

with this OnChanged script:

```auto
if currentValue > self.getSibling("Limit").props.text:
		body = "Le " + self.getSibling("Nom").props.text + " de la " + stringFormat(" %d", (self.getSibling("Line").props.text)) + " a dépassé la limite maximum ajusté à " + stringFormat("%d", self.getSibling("Limit").props.text) +" mm avec une valeur de " + stringFormat("%d", currentValue)
		recipients = ["laurie.croteau@krugerproducts.ca"]
		system.net.sendEmail("mail.example.com:25", "mail.kruger.com", "Changement du diamètre de fin sur un Unwinder", body, 0, recipients)

```

Is it because I used `.getSibling`?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 1, 2021, 5:57pm UTC](https://forum.inductiveautomation.com/t/stringformat-error-perspective/52581/2 "2021-11-01T17:57:39Z")

</div>

`stringFormat` is an expression function and you are writing Python/Jython code here.

You want to use Python’s string formatting library functions or syntax instead: [7.1. string — Common string operations — Python 2.7.2 documentation](https://python.readthedocs.io/en/v2.7.2/library/string.html#format-string-syntax)

---

<div class="post-metadata">

**Author:** ![laurie.croteau](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@laurie.croteau](https://forum.inductiveautomation.com/u/laurie.croteau)\
**Post date:** [November 1, 2021, 6:22pm UTC](https://forum.inductiveautomation.com/t/stringformat-error-perspective/52581/3 "2021-11-01T18:22:49Z")

</div>

I don’t understand the explanation in the link, but I found this and it work, thanks.

```auto
txt1 = "My name is {fname}, I'm {age}".format(fname = "John", age = 36)

```

---

<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 1, 2021, 6:38pm UTC](https://forum.inductiveautomation.com/t/stringformat-error-perspective/52581/4 "2021-11-01T18:38:27Z")

</div>

Less obscure explanation of ‘new style’ formatting available in Python 2.7:  
[https://pyformat.info/](https://pyformat.info/)
