# How does Ignition implement basic slicing?

**URL:** <https://forum.inductiveautomation.com/t/how-does-ignition-implement-basic-slicing/75894>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [July 4, 2023, 2:09pm UTC](https://forum.inductiveautomation.com/t/how-does-ignition-implement-basic-slicing/75894 "2023-07-04T14:09:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 4, 2023, 2:09pm UTC](https://forum.inductiveautomation.com/t/how-does-ignition-implement-basic-slicing/75894/1 "2023-07-04T14:09:09Z")

</div>

i have a coordinate container in which reside an input field, a label, and a button; `firstName`, `outputTarget`, and `btn1` respectively. all i want is the first initial (or whatever slice of text) of the entered text. since the code below, which i have placed on the button's `onClick` event, throws an error, can you please tell me how Ignition wants us to do these kind of things?

```python
#	get first initial of entered name
if (len(self.getSibling("firstName").props.text) > 0):
	self.getSibling("outputTarget").props.text = self.getSibling('firstName').props.text[0,1]

```

the error thrown is:

```plaintext
TypeError: unicode indices must be integers # umm... whut?

```

i even tried to decouple the thing and did this:

```python
#	get first initial of entered name
if (len(self.getSibling("firstName").props.text) > 0):
	theFirst = self.getSibling('firstName').props.text
	self.getSibling("outputTarget").props.text = theFirst[0,1]

```

but that didn't work either and i got the same error. last i checked both zero and one are integers...

as a final check, i straight-up assigned a string to the `outputTarget` and it displayed correctly, so i am targeting correctly.

thank you.

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [July 4, 2023, 2:42pm UTC](https://forum.inductiveautomation.com/t/how-does-ignition-implement-basic-slicing/75894/2 "2023-07-04T14:42:51Z")

</div>

You are so close.... try using a : instead of ,

> **[Python Strings (With Examples)](https://www.programiz.com/python-programming/string)**
>
> In this article, we will learn about the Python Strings with the help of examples.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 4, 2023, 2:44pm UTC](https://forum.inductiveautomation.com/t/how-does-ignition-implement-basic-slicing/75894/3 "2023-07-04T14:44:17Z")

</div>

\*_facepalm_\* i need to get some sleep.... JS + Python + PHP + Ignition... and a deadline.
