Ok this feels like it should be trivial but i cannot figure out how to do it...
say i've got something like
jsonGet("{item: [1,2,3,4,5]}", 'item')
which outputs [1, 2, 3, 4, 5]. I would like to use index notation to pull out the second element of that array, per Expression Language and Syntax | Ignition User Manual. But
jsonGet("{item: [1,2,3,4,5]}", 'item')[1]
gives me an error_TypeConversion for the quality (item.1 doesn't work either)!
XY problem avoidance: i'd like to set an array as a property on a component, and then have another property on that component be that array indexed by a tag -- i.e.
component.customprop=[1, 2, 3, 4, 5]
component.text = toString(component.customprop[{tagPath}])
EDIT: The plot thickens...because { "valueSource": "expr", "expression": "jsonGet(\"{item: [1, 2, 3, 4, 5]}\", \u0027item\u0027)", "dataType": "StringArray", "name": "New Tag", "tagType": "AtomicTag" }
gives me an array of length 1, whos only value is '12345'
Ok, { "valueSource": "expr", "expression": "jsonGet(\u0027{\"item\": [\"1\", \"2\", \"3\", \"4\", \"5\"]}\u0027, \u0027item\u0027)", "dataType": "StringArray", "name": "New Tag", "tagType": "AtomicTag" }
Gives me "1", "2", "3", "4", "5"
as a single string value which can't be correct, since it's not even valid json