# What am I doing wrong with this transform script

**URL:** <https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692>\
**Category:** Ignition\
**Created:** [May 21, 2024, 4:19pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692 "2024-05-21T16:19:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [May 21, 2024, 4:19pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/1 "2024-05-21T16:19:49Z")

</div>

Have a set of values (var color and size) which I can access with like a print / return function in order to display their current value ( can make it read out "Color: 3" for example)

But I can't get this script to function how I want it. I want to be able to have it display different values depending on which color is selected in the current station but I think I am doing it very wrong.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/2/b28bad957283d16fbcee84fd254c474f654bed9a.png)

Again to clarify because I can be a bit bad at putting my thoughts to paper, everything above the if statement works, the rest doesn't work.

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [May 21, 2024, 4:26pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/2 "2024-05-21T16:26:58Z")

</div>

See that little red rectangle on the right? That indicates a syntax/formatting problem. The "if" and "elif" and "else" are not indented correctly. Remember in Python, indentation has meaning, unlike most other languages...

Also, it's helpful to hover your cursor over the red "Error\_Configuration" which should give a clue as to what is failing.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [May 21, 2024, 4:28pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/3 "2024-05-21T16:28:32Z")

</div>

Also you are missing colons after the if statements.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [May 21, 2024, 4:53pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/4 "2024-05-21T16:53:21Z")

</div>

Sorry should've been more descriptive, I've tried indenting it a few different ways already and cant get it to work each way, the message displayed during cursor hover isn't very helpful, even when googling it.  
So far I have tried:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/26b93606cedf144df8eeef372ea1e3a563572933.png)  
and  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/d/9d30b0a9b087b66a4f60121cd26ee6e3f59c68d2.png)  
and a few other variations

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 21, 2024, 4:54pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/5 "2024-05-21T16:54:49Z")

</div>

The conditional expressions for `if` and `elif` belong on the same line, and the colon is after that. Perhaps you should run through some python tutorials.

(Once you get a squiggly red marker, nothing below that point is even looked at. The problem is **right there**.)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [May 21, 2024, 4:55pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/6 "2024-05-21T16:55:35Z")

</div>

Post your code formatted with ```. Then we can help a bit better.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 21, 2024, 4:56pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/7 "2024-05-21T16:56:37Z")

</div>

> **[Python If Statement](https://www.w3schools.com/python/gloss_python_if_statement.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [May 21, 2024, 4:59pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/8 "2024-05-21T16:59:51Z")

</div>

Haha I've been trying my best to self educate with python but clearly I am missing some basics. This entire script might not even be the correct way to do this it is simply the way I managed to figure it out. When you say the conditional expressions belong on the same line do you mean it should for example read:

"if color == 3:  
(indent)return "3000""

---

<div class="post-metadata">

**Author:** ![D\_Mitri\_Tompkins](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@D\_Mitri\_Tompkins](https://forum.inductiveautomation.com/u/D_Mitri_Tompkins)\
**Post date:** [May 21, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/what-am-i-doing-wrong-with-this-transform-script/90692/9 "2024-05-21T17:01:09Z")

</div>

Yep that was it, holy cow what a silly mistake thank you so much
