Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

prune a branch of Hierarchy Tree WIthout Pushing nodes Up??


  • Is there any way to do this without having the editor push the nodes up to the next level? To Simply prune the branch if you have inadvertently created an unwanted branch with say 1500 extra folders lol


  • What does that mean? You wish it deleted empty folders beneath the one you delete? Maybe some SQL is the ticket?

    -- delete all empty folders (no subfolders or points)
    delete from dataPointHierarchy where id not in (select distinct pointFolderId from dataPoints union select distinct parentId from dataPointHierarchy);
    

    You can just keep running it until it returns 0 or put it in such a loop.


  • I created a bunch of empty directories off on two separate branches off the root during some json importing of the hierarchy. If I move these enpty branches into the tree branch that has directories of the same name and it should only leave the one and combine the subfolders of the same name. That would resolve the issue and no script required but instead it creates two entries with the same name in that parent folder and that is the issue as a hierarchy should have unique subfolder names.


  • There is no guarantee that hierarchy paths are unique. Whether they should be or not, one can argue, but they never have been. You probably could have achieved what you were going for by exporting the point hierarchy, getting only the section you wish to rename (all the way to its root) and the rename the folder you want to merge to the other. Then at import it should move all the points into the folders now specified.


  • Is it possible to completely delete the dataPointHierarchy with a delete * and then re-import the correct json? .. that seems faster than to keep rerunning the sql script endlessly
    Would anything screw up from that?


  • To reset the data point hierarchy, you can,

    update dataPoints set pointFolderId=0;
    delete from dataPointHierarchy;
    

    And then importing the JSON would set that structure back up.

    Edit again: I'm not really sure if there may or may not be issues, but I intend to look into it more.


  • OK thanks Phil, I have these empty directories moved into a subfolder so we can deal with this when you say its safe to do so. Thanks again.


  • If their are issues to be uncovered, they'd be easily remedied: restart Mango after your hierarchy surgery (or just all the running data sources).


  • I don't think the point folder id is ever used from a call like ((DataPointRT)obj).getVO().getPointFolderId(); so I don't think there is any issue, and things should work properly after importing the JSON.


  • OK I will give it a whirl and report back :-)
    Thanks


  • Phil, I'm going to stay on the cautionary side and not zap the hierarchy table after all. These empty folder structures are not showing up in the watchlist builder so unless you think it impacts performance I will just hide them for now.


  • I looked into it pretty deeply and didn't expect issue. Do what you feel.