# Perspective: How can I reorder array elements \*\*and maintain bindings\*\*?

**URL:** <https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [October 26, 2020, 11:27am UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011 "2020-10-26T11:27:06Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 26, 2020, 11:27am UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/1 "2020-10-26T11:27:06Z")

</div>

v8.1.0rc1  
Is there any way to rearrange property array elements and still keep the bindings intact within each array element’s objects? The only way I know of to rearrange elements is by copy/paste to text editor, rearrange, copy/paste back on top in Ignition, however this method doesn’t keep bindings intact…

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 26, 2020, 11:43am UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/2 "2020-10-26T11:43:49Z")

</div>

It must be getting late… you can copy the json of the whole component itself, rather than just the array property. Although it’s not that easy, as you have to move the array element itself as well as reshuffle the indices of the bindings, and the bindings appear in the order in which they were created, not in the order of the index 😕 It’d be nice if there was a better way

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 26, 2020, 12:08pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/3 "2020-10-26T12:08:29Z")

</div>

You can’t change the order by dragging?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 26, 2020, 12:19pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/4 "2020-10-26T12:19:52Z")

</div>

Nope ☹

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 26, 2020, 12:31pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/5 "2020-10-26T12:31:37Z")

</div>

Really, I must be confused on what you are saying because I’m able to reorder properties by dragging.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 26, 2020, 12:46pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/6 "2020-10-26T12:46:38Z")

</div>

hmm, I’m in v8.1.0rc1, what are you running?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 26, 2020, 12:59pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/7 "2020-10-26T12:59:08Z")

</div>

8.0.16

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 26, 2020, 1:10pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/8 "2020-10-26T13:10:52Z")

</div>

Weird, I definitely can’t click and drag them. I’m on Windows

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 26, 2020, 1:14pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/9 "2020-10-26T13:14:08Z")

</div>

Do you mind showing a picture just to make sure we are talking about the same thing?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 26, 2020, 1:37pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/10 "2020-10-26T13:37:25Z")

</div>

I’m not at my laptop anymore but will in the morning. However to describe it, i’m talking about the properties of a component, e.g. A dropdown component’s data array property that configures the items available in the drop down menu. If I try to click and drag the array elements to move index 0 below index 1, nothing happens

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 26, 2020, 1:46pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/11 "2020-10-26T13:46:23Z")

</div>

I added a dropdown to a view, bound to a query and used format json. Then I unbound. I was able to drag and reorder. I grabbed to the right of the plus sign. I was also able to reorder the items under each “index”, however, for that to work I had to grab on the left side. It’s definitely clunky in my opinion.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 26, 2020, 3:46pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/12 "2020-10-26T15:46:07Z")

</div>

You can re-order by dragging array elements. As @jlandwerlen suggested, you need to click-hold to the _right_ of the element you’d like to re-arrange. This will NOT bring the binding along. You can’t supply a binding base don arbitrary relative positions to change if the position changes.

When you set up a binding within an array, it’s defined in the schema as `custom.my_array[x].some_key`. dragging the element to a different position results in the binding pointing to the original position because the `x` in the _binding_ has not changed. If you need to re-arrange array elements and update bindings, it sounds like you should actually be using an object because that array position apparently means something more specific than an index would suggest.

```auto
bays: {
    "one": {},
    "two": {},
    "three": {}
}

```

is more correct than

```auto
bays: [
    0: {},
    1: {},
    2: {}
]

```

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 26, 2020, 4:19pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/13 "2020-10-26T16:19:17Z")

</div>

> [@cmallonee](#):
>
> This will NOT bring the binding along.

That's interesting, when I tested earlier, it looked like the bindings went with it, but I only looked at the values, not the bindings themselves. When I closed and opened the view again the values updated and then I did notice what you are referring to.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 26, 2020, 4:37pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/14 "2020-10-26T16:37:19Z")

</div>

While I understand that any runtime manipulations of the array cannot expect to have bindings adjusted, I’m a bit perplexed at the idea that the designer simply _ **can’t** _ move the bindings. The designer is making the edit, and it knows where the bindings are, so it should be **possible** to move the bindings with the edit. If someone were to make a feature request…

(It may still be an unfair comparison, but Vision is astonishingly good at manipulating bindings appropriately when editing windows and templates. This is a “polish” item for Perspective.)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 26, 2020, 4:54pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/15 "2020-10-26T16:54:20Z")

</div>

We do have a feature ticket open for something similar (the ticket only specifies updating bindings when an element is ADDED to an array), and I’ve made a note to consider any element movement. The problem with moving a binding is maybe I do NOT want the binding to move. Someone is going to request the opposite of whatever we do here, so we have to look at it like this:

Scenarios:

1. User wants the binding on element `y` instead of element `x`.  
Solution: copy/paste the binding to element `y` and remove it from element `x`.
2. User wants to move value from element `x` to element `y`.  
Solution: drag/drop - which does NOT bring the binding.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 26, 2020, 8:41pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/16 "2020-10-26T20:41:11Z")

</div>

My case is, I have an SVG that I embedded - a simple square box. I set aspect ratio to `none` and then made it a wide and short rectangle to act as a bar chart for an analogue display. I copied the element so I had 5 rectangles, one each for: PV, and Alarm setpoints: HH, H, L, LL, below (L and LL set to 0).  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/d/adbb43e54ca0be50517a6ca67c540db900532ec2.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/8/d89b79327129d73acd68e390cbecf8943c5c6e21.png)  
Each element has a different `clip-path` style binding. However after creating and binding everything, I realised that I’d put the PV above everything else instead of behind… hence needing to move it to the top (to get it to the bottom 🙂 ), bindings intact.  
(thanks again to @dkylep for that clip-path tip! [Perspective Equivalent Vision Level Indicator? - #4 by dkylep](http://forum.inductiveautomation.com/t/perspective-equivalent-vision-level-indicator/37786/4))

If you deliberately bind to properties within an array element and want to move the element to another position, I personally can’t see a use case to _not_ move the binding with it 🤔

---

<div class="post-metadata">

**Author:** ![michael2](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@michael2](https://forum.inductiveautomation.com/u/michael2)\
**Post date:** [July 12, 2021, 4:58am UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/17 "2021-07-12T04:58:04Z")

</div>

What was the outcome of this? Did it ever get fixed?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 26, 2023, 5:40am UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/18 "2023-06-26T05:40:47Z")

</div>

Late, but no, this has not been fixed ☹

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 17, 2024, 7:49pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-reorder-array-elements-and-maintain-bindings/40011/19 "2024-09-17T19:49:14Z")

</div>

As of [8.1.39](https://inductiveautomation.com/downloads/releasenotes/8.1.39#:~:text=Property%20configs%2C%20including%20bindings%2C%20remain%20assigned%20to%20moved%20or%20shifted%20array%20items%20within%20the%20Property%20Editor.), bindings within arrays now move when their element of the array is re-ordered.
