Ignition props interprets script return wrongly

Hi all,

Little unsure how to search for an answer for this!

I've got a property binding that I want to return an array of objects (esentially a dataset... but I want it in JSON form, not a dataset)
The script returns the correct structure, but ignition puts it as a string.

If I copy and paste the data, it formats it correctly
image

How do I ask ignition nicely to recognise the structure? (Noted the array length changes)

Binding is as follows:

Thanks!
:smiley:

Don't use json.dumps. That's what is creating the string. Just return the jython list of jython dictionaries. Perspective will accept that as an array of objects.

Could have sworn I tried that earlier ... Home time I think!
Thanks @pturmel ! :smiling_face:

You might also like my Integration Toolkit's solution:

forEach(
	{this.custom.selectedCylinderIds},
	it()
)

Just an expression binding, no transform, no jython overhead.

2 Likes

Thats super useful to know thanks!
I've just installed the Integration Toolkit yesterday, but havent yet fully got to grips with how I use all the functions! Need to have a detailed read of the docs with a coffee.

I wont derail this thread too far, but I was trying to work out how to call a script that passes an array into it as a parameter. Then do this conversion on the output. The screenshot in my original post has a 'value' parameter of [1,4,6] or [2,4,7,8,9] etc

Oh, I see. That would be an inner join. Also part of my Integration toolkit. (Could also be done with asMap() and where().)