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.
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:
[{'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 but my script doesn’t modify the value passed in.