# The pain of moving Perspective array indices with bindings

**URL:** <https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 7, 2023, 10:57am UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715 "2023-03-07T10:57:50Z")\
**Posts on this page:** 10\
**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:** [March 7, 2023, 10:57am UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/1 "2023-03-07T10:57:50Z")

</div>

I just want to leave this here for those who understand

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/e/5edb83b13379910f9303376685aa8885149f95fb.png)

And yes, I will move these by copying the JSON and editing it in NPP, because I value my sanity.  
I really hope this is fixed one day though so I don't have to export it out

Edit:  
Actually, even editing it in NPP is hard... I think I'll write a script to process it

Maybe @paul-griffith can add a graphical interface to do it in Kindling haha ☹ (I'm only joking, mostly)

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [March 7, 2023, 1:58pm UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/2 "2023-03-07T13:58:56Z")

</div>

It may not be a good solution, but I'm curious how well my recent adventures [editing views in YAML](https://forum.inductiveautomation.com/t/spotting-non-default-properties-in-perspective-views/70244/6) would work for this...

I'm finding a lot of things are much easier and more manageable in the YAML version: weirdly escaped expressions and scripts are directly editable; nesting levels are easier to manage (just add/remove indent to match); and the indent also makes it easier to tell which properties are on which component.

I suspect YAML wouldn't fully resolve your complications, but I think it would help.

It's dirt-simple, but here: [Minimal JSON-to-YAML converter with smarter multi-line handling · GitHub](https://gist.github.com/jbrzozoski/9a12a5b25293cc2be7f09cfa33e6a46e)

Only pip requirement is `pip install ruamel.yaml`

EDIT: Just tried moving a bunch of bound array items in YAML. It's still a lot of indexing to be manually updated, but it's easier on my eyes to spot them.

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [March 7, 2023, 3:50pm UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/3 "2023-03-07T15:50:56Z")

</div>

I often end up using the Vim plugin in VS Code with macros to do this kind of repetitive editing work. Although I haven't looked into the specific format for these arrays, it could be a good middle ground between manual editing and scripting. Of course if you're going to do it a lot, please write a script (and please share it with us 😄)

---

<div class="post-metadata">

**Author:** ![j.israelsen](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@j.israelsen](https://forum.inductiveautomation.com/u/j.israelsen)\
**Post date:** [March 7, 2023, 5:56pm UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/4 "2023-03-07T17:56:33Z")

</div>

Yes, there have been many times where I haven wanted to do the same thing. Like you mentioned, one thing would be to copy the object and paste it in a simple editor (like NPP or even Excel can work). Then you can make your change, copy it from the editor, and paste it back into Ignition. Of course it can be hard if your objects are large.

Beyond that, unfortunately, I don't have any great workarounds as of yet. Maybe add as a feature request? Or maybe request or make an Ignition Exchange resource?

---

<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:** [March 8, 2023, 12:23am UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/5 "2023-03-08T00:23:22Z")

</div>

I'm actually interested if this is something that can be accomplished with a VS Code extension? I'm sure it is...

This one looks like it would be a good candidate to modify?? @kgamble 😃 (I've had a look and my 15min tells me I'm currently in over my head)

> **[GitHub - sunmorgus/vscode-json-editor: A vscode extension to preview and edit...](https://github.com/sunmorgus/vscode-json-editor)**
>
> A vscode extension to preview and edit JSON documents in a simple tree view, based on . - GitHub - sunmorgus/vscode-json-editor: A vscode extension to preview an...

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [March 8, 2023, 1:00am UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/6 "2023-03-08T01:00:23Z")

</div>

So to clarify, the goal is to be able to insert/move/delete objects in an array while persisting binding locations?

---

<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:** [March 8, 2023, 1:11am UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/7 "2023-03-08T01:11:37Z")

</div>

Yep, that's the gist! Just to clarify, `delete` would remove the binding. This would be unbelievably useful to have (although it _shouldn't_ be necessary imnsho)

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [March 8, 2023, 1:35am UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/8 "2023-03-08T01:35:38Z")

</div>

Hmm thinking about it, here's a few thoughts:

- Would it make sense to use a JSON editor for this? Or essentially just create a version of the project explorer that shows the components properties underneath it similar to the json explorer?
- Would you want to essentially "click and drag" to move around the props if they are in an array? Not sure where else this would be useful. Maybe a "shift + click and drag" edits it the way it currently works?
- Almost feels easier to build something based off something like [this tree viewer](https://mui.com/material-ui/react-tree-view/#gmail-clone)

EDIT: After looking around for more than 10 seconds I realized that VS Code currently creates an `outline` of the json doc, essentially this would be what's needed?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/9/e973d6f8717c7710383b3c3db250236e614dd0f8.png)

Something that would make this 100x easier is if any of the JSON schemas are publicly available (especially for perspective views). Would make it much easier to create the DocumentSymbol provider needed to do a lot of these things. I mean, I could obviously make the schema by hand... but it will evolve and change and that's a painful task \*cough @paul-griffith

---

<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:** [March 8, 2023, 2:02am UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/9 "2023-03-08T02:02:34Z")

</div>

> [@kgamble](#):
>
> Almost feels easier to build something based off something like [this tree viewer](https://mui.com/material-ui/react-tree-view/#gmail-clone)

That looks a bit nicer 👍

> [@kgamble](#):
>
> EDIT: After looking around for more than 10 seconds I realized that VS Code currently creates an `outline` of the json doc, essentially this would be what's needed?

I knew about this one already, and it's super helpful, but I didn't think you'd be able to hook into this and make it do your own thing like editing the propConfig, or can you?

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [March 8, 2023, 3:16am UTC](https://forum.inductiveautomation.com/t/the-pain-of-moving-perspective-array-indices-with-bindings/70715/10 "2023-03-08T03:16:03Z")

</div>

> [@nminchin](#):
>
> but I didn't think you'd be able to hook into this and make it do your own thing like editing the propConfig, or can you?

You can! By creating a DocumentSymbolProvider I could essentially create that exact outline, however one of the requirements would be to have the JSON schema defined

Once again, I could do so by hand, but what an obnoxious task that would be. As opposed to it potentially being made public as a part of the sdk \*cough @PerryAJ (i don’t know who to keep “coughing” into this thread for that really specific request lol)

EDIT: Actually, after a little digging around I found that the schemas are located inside the jar file for `perspective.common`, so I could technically get what I am looking for there... Maybe there is an answer here. Still feels like a relatively hacky one
