# Parse Error in Script Transform After List of Dictionaries Manipulation

**URL:** <https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [April 11, 2022, 4:32pm UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310 "2022-04-11T16:32:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrea\_Rector](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Andrea\_Rector](https://forum.inductiveautomation.com/u/Andrea_Rector)\
**Post date:** [April 11, 2022, 4:32pm UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310/1 "2022-04-11T16:32:20Z")

</div>

I have data from a Query Binding being sent as JSON to a script transform. I can run the following in the Script Console successfully.

```auto
value = [{"rowindex":0,"projectid":"U8","description":"32 project","plmt":"controller"},
		{"rowindex":1,"projectid":"U9","description":"b project","plmt":"controller"},
		{"rowindex":2,"projectid":"U10","description":"m project","plmt":"controller"}]

rowIndexColumn_ASLIST=[row["rowindex"] for row in value]

projectList=[]

for x in rowIndexColumn_ASLIST:
	projectItem={
		"target":"/"+value[x]["projectid"]+"/0",
		"label":{
			"text":value[x]["description"]
		}, 
		"visible": True, 
		"enabled": True, 
		"showHeader":True
	}
	projectList.append(projectItem)
	projectItem={}

print (projectList)

```

The result I get is this, which is exactly what I want:

```auto
[{'visible': True, 'showHeader': True, 'label': {'text': '32 project'}, 'enabled': True, 'target': '/U8/0'}, 
{'visible': True, 'showHeader': True, 'label': {'text': 'b project'}, 'enabled': True, 'target': '/U9/0'}, 
{'visible': True, 'showHeader': True, 'label': {'text': 'm project'}, 'enabled': True, 'target': '/U10/0'}]

```

It seemed to be working so I copied the script over to the Binding window, and adjusted a couple lines so I’m pulling in the query’s value instead of defining it and returning ProjectList instead of printing it. In the end, I get the Error\_Configuration: Parse Error in Script Transform.

The error seems similar to the one in [this post](https://forum.inductiveautomation.com/t/script-transform-giving-scripteval-errors-with-seemingly-valid-dictionary-manipulation/25304) but my script doesn’t modify the value passed in.

---

<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:** [April 11, 2022, 4:33pm UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310/2 "2022-04-11T16:33:31Z")

</div>

`ParseError` means exactly that: There’s a problem parsing your code.

Post the _exact, actual code_ you have in the script transform here.

---

<div class="post-metadata">

**Author:** ![Andrea\_Rector](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Andrea\_Rector](https://forum.inductiveautomation.com/u/Andrea_Rector)\
**Post date:** [April 11, 2022, 4:51pm UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310/3 "2022-04-11T16:51:31Z")

</div>

```auto
rowIndexColumn_ASLIST=[row["rowindex"] for row in value]
	
projectList=[]

for x in rowIndexColumn_ASLIST:
	projectItem={
		"target":"/"+value[x]["projectid"]+"/0",
		"label":{
			"text":value[x]["description"]
		}, 
		"visible": True, 
		"enabled": True, 
		"showHeader":True
	}
	projectList.append(projectItem)
	projectItem={}

return projectList

```

---

<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:** [April 11, 2022, 5:11pm UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310/4 "2022-04-11T17:11:02Z")

</div>

Hm, nothing obviously wrong with your script. If you hover over the ‘ParseExpression’ error, is any more information displayed in the tooltip?

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [April 11, 2022, 6:36pm UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310/5 "2022-04-11T18:36:56Z")

</div>

I’m using version 8.1.15 and I mocked up a Named Query and used your transform code and it seems to be working fine. Check your spacing or indentation maybe?

If you don’t indent properly you might see a Parse Error in the Error\_Configuration message.

---

<div class="post-metadata">

**Author:** ![Andrea\_Rector](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Andrea\_Rector](https://forum.inductiveautomation.com/u/Andrea_Rector)\
**Post date:** [April 11, 2022, 8:05pm UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310/6 "2022-04-11T20:05:11Z")

</div>

That was it. I wasn’t indented under the def function. Thank you!

---

<div class="post-metadata">

**Author:** ![Oscar\_Simon](https://avatars.discourse-cdn.com/v4/letter/o/bc79bd/32.png) [@Oscar\_Simon](https://forum.inductiveautomation.com/u/Oscar_Simon)\
**Post date:** [September 9, 2024, 11:41pm UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310/7 "2024-09-09T23:41:27Z")

</div>

It's important to note that the dataset passed to the script is an Ignition dataset, which is immutable and presented as an enumerator. To manipulate the data, you need to convert it to a `PyDataset` using the `system.dataset.toPyDataSet(value)` function. This conversion allows you to work with the data in a more flexible format, enabling you to perform any desired manipulations. I know this was not your issue, but this was the issue for me.

---

<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:** [September 10, 2024, 12:12am UTC](https://forum.inductiveautomation.com/t/parse-error-in-script-transform-after-list-of-dictionaries-manipulation/58310/8 "2024-09-10T00:12:25Z")

</div>

A `PyDataset` is a thin wrapper around a general `Dataset`, and is therefore also immutable. But it presents a dataset in jython as a python-like list of lists, which is quite handy when constructing a new dataset with modified content.
