# How to concatenate strings in Vision event Scripting

**URL:** <https://forum.inductiveautomation.com/t/how-to-concatenate-strings-in-vision-event-scripting/93630>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [July 23, 2024, 7:34pm UTC](https://forum.inductiveautomation.com/t/how-to-concatenate-strings-in-vision-event-scripting/93630 "2024-07-23T19:34:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [July 23, 2024, 7:34pm UTC](https://forum.inductiveautomation.com/t/how-to-concatenate-strings-in-vision-event-scripting/93630/1 "2024-07-23T19:34:45Z")

</div>

I pull three strings from three components, and would like to join them together into one CSV string.  
Python uses `+` to concatenate, but that does not work, I get a `TypeError: bad operand type for unary + ` error.  
For example:

```python
if(event.source.parent.selected_option)==1:
	comments = event.source.parent.getComponent('Radio Button').text + ',' 
	+ event.source.parent.getComponent('Dropdown').selectedStringValue
	+ ',' + event.source.parent.getComponent('Dropdown 1').selectedStringValue

```

It does not like the `&` symbol either. I have not found a function, yet, that does this.

Thank you

---

<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:** [July 23, 2024, 7:46pm UTC](https://forum.inductiveautomation.com/t/how-to-concatenate-strings-in-vision-event-scripting/93630/2 "2024-07-23T19:46:00Z")

</div>

The plus symbol isn't the problem, your line wrapping is. You need to put all the concatenation on one line, or use a different line ending to tell Python it's all one statement, or use a different mechanism for concatenation entirely. There's a bunch of options, but this is entirely a syntax error.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [July 23, 2024, 7:49pm UTC](https://forum.inductiveautomation.com/t/how-to-concatenate-strings-in-vision-event-scripting/93630/3 "2024-07-23T19:49:17Z")

</div>

What could I use as a different line ending?

---

<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:** [July 23, 2024, 8:00pm UTC](https://forum.inductiveautomation.com/t/how-to-concatenate-strings-in-vision-event-scripting/93630/4 "2024-07-23T20:00:34Z")

</div>

> **[Python - Multi-Line Statements - GeeksforGeeks](https://www.geeksforgeeks.org/python-multi-line-statements/)**
>
> A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

Generally the `\` character is used in this scenario.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [July 23, 2024, 8:27pm UTC](https://forum.inductiveautomation.com/t/how-to-concatenate-strings-in-vision-event-scripting/93630/5 "2024-07-23T20:27:33Z")

</div>

Sorry Paul,  
I realized after I walked away I could have looked this up easily. Got a lot of things on my plate and spaced it. And thank you!
