# Change script issue is throwing an error

**URL:** <https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 13, 2025, 12:08pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182 "2025-05-13T12:08:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charlie\_Boykin](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@Charlie\_Boykin](https://forum.inductiveautomation.com/u/Charlie_Boykin)\
**Post date:** [May 13, 2025, 12:08pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/1 "2025-05-13T12:08:37Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/5/3552d6276ee3aab8af001120e30ed4e4335f1aec.png)

I'm using a change script that is working but it is also throwing an error. The script works perfectly and all the custom properties are being assigned correctly. But this error above is still showing up.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e6e5ead9d11ae277cd1e463b1c1a05cafbc57f27.png)

Self.custom.ContractDrpdwn is bond to a dropdown box component. The value and option of that dropdown component is bond to a dataset memory tag that is normally 30 x 1 dataset.

When this change script is triggered it takes the full name that is selected from the dropdown list and I need to slice that full name down to the first 6 characters.

That sliced full name is used later in a search and data call to the database.

I've tried to take contractdrpdwn and convert it to a pyDataset and a regular Dataset it doesn't allow it to happen.

Both properties self.custom.ContractDrpdwn and self.custom.Ket data is working correctly. The error still pops up and I'm trying get rid of that error.

Why is this error coming up and how can I solve this issue.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 13, 2025, 12:09pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/2 "2025-05-13T12:09:43Z")

</div>

Please 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:** ![Chris\_Bingham](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Chris\_Bingham](https://forum.inductiveautomation.com/u/Chris_Bingham)\
**Post date:** [May 13, 2025, 12:32pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/3 "2025-05-13T12:32:50Z")

</div>

If you edit your original post to remove the screenshot, and instead paste your code in a code block, the code will be much easier for forum members to review.

The error is directing you to line 6, and proclaiming that the BasicDataset is unsubscriptable - presumably your FullContractName property.  
Are you certain this is the correct script for that error?  
Is there any chance that another version of this script also lives elsewhere?

---

<div class="post-metadata">

**Author:** ![Charlie\_Boykin](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@Charlie\_Boykin](https://forum.inductiveautomation.com/u/Charlie_Boykin)\
**Post date:** [May 13, 2025, 1:25pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/4 "2025-05-13T13:25:59Z")

</div>

I resolve the issue. I created a name string variable assigned it the FullContractName and made sure to convert it to a string

name = str(self.custom.FullContractName)

Then I sliced the name variable then I assigned it to Ket property and like I need and my issue went away.

self.custom.Ket = name[0:6]

---

<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:** [May 13, 2025, 1:29pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/5 "2025-05-13T13:29:54Z")

</div>

The issue was that your `FullContractName` property was holding a dataset, not a string.  
The proper way to fix it is to change how its data is computed.  
I expect you have a binding on it. Modify this binding to extract the value you need from the dataset.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 13, 2025, 1:37pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/6 "2025-05-13T13:37:48Z")

</div>

> [@Chris\_Bingham](#):
>
> you edit your original post to remove the screenshot, and instead paste your code in a code block, the code will be much easier for forum members to review.

Maybe I'm the only one, but I totally disagree with pasting code instead of screenshots for identification of errors like this one. Code blocks don't have row numbers, and even if they did they're not guaranteed to be the same as the original code. Then it just makes it harder to explain which row is failing 🤷

---

<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:** [May 13, 2025, 1:40pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/7 "2025-05-13T13:40:03Z")

</div>

Maybe we should ask discourse to add the possibility to add line numbers, starting wherever we want ?

You can have syntax highlighting, you can even chose the language:

> ```python  
> python code goes here  
> ```

---

<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:** [May 13, 2025, 2:55pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/8 "2025-05-13T14:55:42Z")

</div>

@nminchin, @pascal.fragnoud: As the author of the linked article I agree that context is useful in some situations. If we're to add line numbers to the forum's pre-formatted code block can they be omitted from the clipboard copy function?

---

<div class="post-metadata">

**Author:** ![Chris\_Bingham](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Chris\_Bingham](https://forum.inductiveautomation.com/u/Chris_Bingham)\
**Post date:** [May 13, 2025, 8:06pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/9 "2025-05-13T20:06:19Z")

</div>

> [@nminchin](#):
>
> Maybe I'm the only one

You're not. To assert myself 'on the fence' - I certainly referenced the screenshot to get the insight needed (row number) for follow-up questions. That said, I appreciate (& value) consistency for a standard where possible. Copying the code block to a script console to obtain row numbers, but also any potential formatting issues & typos, etc., seems preferrable to 'the forum'.

To expand on my initial questions:

> [@Charlie\_Boykin](#):
>
> The script works perfectly and all the custom properties are being assigned correctly

How is the possible when there is an error on line 6? Since when does code continue executing following a runtime error (w/o exception handling)?

---

<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 13, 2025, 9:57pm UTC](https://forum.inductiveautomation.com/t/change-script-issue-is-throwing-an-error/106182/10 "2025-05-13T21:57:29Z")

</div>

> [@Chris\_Bingham](#):
>
> How is the possible when there is an error on line 6

The OP is not handling the case where this script fires before a binding has delivered a proper value to `self.custom.FullContractName`, and then fires shortly after and succeeds.
