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?
newValues = []
for x in value:
newValue = {}
for k, v in x.iteritems():
if k == "source":
newValue[k] = v.split(':')[-1]
else:
newValue[k] = v
newValues.append(newValue)
return newValues
I ran into the same issue but then I found that 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 hope this clears up things for someone else.