Hi Keith,
Thanks for the in-depth reply. Apologies if I didn’t make my post clear or if I’m misunderstanding your answer, but I’m not looking to dynamically create/move bindings during runtime. When I duplicated the item in the array, I was referring to right-clicking on the object in the property editor in designer and duplicating it there.
Your answer did make me go and have a look in the JSON and this is what I found. PS1_Geo_Button is the name of the embedded view that I have these parameters on.
Before duplicating the object in the array:
{
"meta": {
"name": "PS1_Geo_Button"
},
"position": {
"height": 47,
"width": 79,
"x": 1216.796875,
"y": 358.875
},
"propConfig": {
"props.params.EngHigh": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "direct",
"tagPath": "[default]Pump Station 1/L01/L01/Process Value.EngHigh"
},
"type": "tag"
}
},
"props.params.labelArray[4].position": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "direct",
"tagPath": "[default]Leachate Pond 1/Aerator/M04-LISP.value"
},
"type": "tag"
}
},
"props.params.processValuePath": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "direct",
"tagPath": "[default]Pump Station 1/L01/L01/Process Value.path"
},
"type": "tag"
}
}
},
"props": {
"params": {
"fillColour": "#AC5F00",
"labelArray": [
{
"in": false,
"label": "Inlet - xx m",
"position": 5,
"side": false
},
{
"in": false,
"label": "Top - 31.697 m",
"position": 100,
"side": true
},
{
"in": false,
"label": "Depth - 3.26 m",
"position": 100,
"side": false
},
{
"in": false,
"label": "Bottom - 0 m",
"position": 0,
"side": false
},
{
"in": true,
"label": "Aerator Inhibit SP",
"side": false
}
],
"pitColour": "#AAAAAA",
"title": "Pump Station 1"
},
"path": "Page/Embedded/Symbols/Geometric_Popup_Pit_Button"
},
"type": "ia.display.view"
}
After duplicating the object in the array:
{
"meta": {
"name": "PS1_Geo_Button"
},
"position": {
"height": 47,
"width": 79,
"x": 1216.796875,
"y": 358.875
},
"propConfig": {
"props.params.EngHigh": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "direct",
"tagPath": "[default]Pump Station 1/L01/L01/Process Value.EngHigh"
},
"type": "tag"
}
},
"props.params.labelArray[4].position": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "direct",
"tagPath": "[default]Leachate Pond 1/Aerator/M04-LISP.value"
},
"type": "tag"
}
},
"props.params.processValuePath": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "direct",
"tagPath": "[default]Pump Station 1/L01/L01/Process Value.path"
},
"type": "tag"
}
}
},
"props": {
"params": {
"fillColour": "#AC5F00",
"labelArray": [
{
"in": false,
"label": "Inlet - xx m",
"position": 5,
"side": false
},
{
"in": false,
"label": "Top - 31.697 m",
"position": 100,
"side": true
},
{
"in": false,
"label": "Depth - 3.26 m",
"position": 100,
"side": false
},
{
"in": false,
"label": "Depth - 3.26 m",
"position": 100,
"side": false
},
{
"in": false,
"label": "Bottom - 0 m",
"side": false
},
{
"in": true,
"label": "Aerator Inhibit SP",
"position": null,
"side": false
}
],
"pitColour": "#AAAAAA",
"title": "Pump Station 1"
},
"path": "Page/Embedded/Symbols/Geometric_Popup_Pit_Button"
},
"type": "ia.display.view"
}
I do notice that the bindings are stored separately inside “propConfig” rather than with the static properties in “props”. Is this what you meant by the bindings not being determined by the data IN the json (as the bindings are not stored in the labelArray json) but by the definition OF the json?
What I’m confused about is:
-
Prior to my duplicating an object into labelArray, the “position” property in object 4 isn’t stored in “props” (As you’ve pointed out it has a binding on it so it’s stored in “propConfig”) - this is fine
-
After duplicating an object the object (now object 5) now has a position property in “props”, so Ignition clearly recognises that this object has a position property even though it wasn’t listed in “props”. I imagine Ignition would have to see the property in “propConfig” to be aware of this. So then why doesn’t it update the property in “propConfig” to move the binding to the new array index?
Also, I’ve just noticed this bug (if it is a bug) only occurs when I duplicate an object in the array. If I delete an object, the binding moves correctly with the rest of the properties:
This screenshot was taken after:
- The binding was on “position” in array index 4
- I duplicated the object in index 2. Objects 3 and 4 incremented their index. The binding remained at array index 4
- I deleted the duplicated object in index 3. Objects 4 and 5 decremented their index. The binding moved from array index 4 to array index 3