# Perspective Tree ordering

**URL:** <https://forum.inductiveautomation.com/t/perspective-tree-ordering/86387>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 26, 2024, 8:07pm UTC](https://forum.inductiveautomation.com/t/perspective-tree-ordering/86387 "2024-02-26T20:07:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [February 26, 2024, 8:07pm UTC](https://forum.inductiveautomation.com/t/perspective-tree-ordering/86387/1 "2024-02-26T20:07:37Z")

</div>

I have a question about a feature I'm implementing using a Perspective Tree component. Here is a picture of the problem:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ec514130fe64dfdce24f14cb62f9c4c2017eb7ed.png)

I would like it to show up in this way:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/42c7816b2e00e33c9773d643cbc60083127745f5.png)

(obviously extrapolated for any number of nodes in the tree).

Here are the paths for each node:

- root: `'123'`
- TH123: `'123$TH123'`
- RT124: `'123$234'`
- RT345: `'123$234$345'`

**The problem** : Notice that `RT345`'s path comes from `234`, but it shows up in the Tree under `TH123`... why?????

I don't want the RT nodes to attach to the TH nodes BUT at the same time, I want the TH nodes to display _first_ (meaning right under the parent nodes).

All of the IDs are coming from two different tables in the database (TH and RT).The reason why I prepended the `TH` to the TH ID in the database is because there will be that one time where the `TH.ID = RT.ID` that will wreck me when I have to troubleshoot this in a year or two.

TIA

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [February 26, 2024, 10:17pm UTC](https://forum.inductiveautomation.com/t/perspective-tree-ordering/86387/2 "2024-02-26T22:17:35Z")

</div>

I hope everyone who reads this post gets amnesia and forgets that I posted it. In the recursive procedure that I'm using to fetch from both tables, I mixed one ID for another, which then wasn't specific enough in the shared script I'm using to transform the dataset to JSON. This wouldn't be an issue, besides that I'm forcing the `TH` records to appear first, so then all of the children attach to it instead of where they should. I found this out during step by step debugging of that function that it wasn't the problem.

I hate recursion.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 27, 2024, 12:37am UTC](https://forum.inductiveautomation.com/t/perspective-tree-ordering/86387/3 "2024-02-27T00:37:03Z")

</div>

A thousand points for not being a DenverCoder9:

> **[Wisdom of the Ancients](https://xkcd.com/979/)**
>
> All long help threads should have a sticky globally-editable post at the top saying 'DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far ...'
