I have data from a Query Binding being sent as JSON to a script transform and the data looks like this:
[ { 'source': 'beginning:end', 'count': 5},
{ 'source': 'beginning2:end2', 'count': 10}]
My goal is to get it to look like this:
[ { 'source': 'end', 'count': 5},
{ 'source': 'end2', 'count': 10}]
And I’m using the following script transform code within the transform function to try to accomplish this:
for x in value:
x['source'] = x['source'].split(':')[-1]
return value
I’ve tested this in the Scripting Console, in online REPLs and this code does exactly what I want. However, I always get Error_ScriptEval
in the Binding Preview when trying to actually use this code as a script transform.
I’m stumped, any ideas as to what is going wrong here?