# Script String Transform

**URL:** <https://forum.inductiveautomation.com/t/script-string-transform/91329>\
**Category:** General Discussion\
**Tags:** scripting\
**Created:** [June 4, 2024, 10:20am UTC](https://forum.inductiveautomation.com/t/script-string-transform/91329 "2024-06-04T10:20:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Edwards](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jeremy\_Edwards](https://forum.inductiveautomation.com/u/Jeremy_Edwards)\
**Post date:** [June 4, 2024, 10:20am UTC](https://forum.inductiveautomation.com/t/script-string-transform/91329/1 "2024-06-04T10:20:10Z")

</div>

I am trying to do a simple transform script, but never used one before. I would like to do a string.title() and cannot get the syntax to work. I have a label that I have added a binding tag to. I saw that there is a add transform button with script as an option. What comes up is:

def transform(self, value, quality, timestamp):  
return value

I have tried

def transform(self, value, quality, timestamp):  
value = string.title()  
return value

But it keeps erroring out.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 4, 2024, 10:23am UTC](https://forum.inductiveautomation.com/t/script-string-transform/91329/2 "2024-06-04T10:23:51Z")

</div>

```python
def transform(self, value, quality, timestamp):
    return value.title()

```

Tip: see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 10, 2024, 8:52am UTC](https://forum.inductiveautomation.com/t/script-string-transform/91329/3 "2024-06-10T08:52:29Z")

</div>

It errors out because `string` doesn't exist. See how `value` is declared in the parameters ? That's why you can use `value`. It's the result of the previous "operation", in this case the binding. If you add a second transform after the first one, its `value` parameter will be whatever the first transform returned.  
`string`, on the other hand, was never declared. So you can't use it.

Some tips:

- errors message are important. They give information about what's wrong. Saying "there's an error" is rarely enough, you need to provide the error message, and maybe even the stack trace.
- Jython is still jython, even inside of ignition. Ignition "only" provides functions for you to use, but you need to use them following the rules of jython. [System Functions | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions)
- if you can, use expressions instead of scripts. expressions DO NOT use jython. They're not a programming language, but you can do many things with them without the overhead of a python interpreter. In this particular case, the built-in expressions are not enough, so you'll need to use a script transform... or use @pturmel 's integration toolkit ([Automation Professionals' Integration Toolkit Module](https://forum.inductiveautomation.com/t/automation-professionals-integration-toolkit-module/74934)). It's a module that adds a bunch of functions, both to scripting and expressions. It makes a lot of things possible to do directly in expressions, that would otherwise require scripting.
- go through the inductive university. It will teach you the basics of using ignition. [https://www.inductiveuniversity.com/](https://www.inductiveuniversity.com/)
