• Recent
    • Tags
    • Popular
    • Register
    • Login

    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 Mango 5 Documentation Website

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

    How-To
    2
    12
    2.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Phillip Weeks
      last edited by Phillip Weeks

      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

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • P
          Phillip Weeks
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • phildunlapP
            phildunlap
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • P
              Phillip Weeks
              last edited by Phillip Weeks

              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?

              1 Reply Last reply Reply Quote 0
              • phildunlapP
                phildunlap
                last edited by phildunlap

                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.

                1 Reply Last reply Reply Quote 0
                • P
                  Phillip Weeks
                  last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • phildunlapP
                    phildunlap
                    last edited by

                    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).

                    1 Reply Last reply Reply Quote 0
                    • phildunlapP
                      phildunlap
                      last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • P
                        Phillip Weeks
                        last edited by

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

                        1 Reply Last reply Reply Quote 0
                        • P
                          Phillip Weeks
                          last edited by

                          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.

                          1 Reply Last reply Reply Quote 0
                          • phildunlapP
                            phildunlap
                            last edited by

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

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post