Jump to content

Remove level from an asset tree

Go to solution Solved by Chris Harp,

Recommended Posts



In one of my asset trees I have 2 levels (red ones) that are useless and I want to get them out while keeping the assets further down the tree.

GBR Wonderware (Level 1)
|-- Public Groups (level 2)
    |-- PBLEINER_BRAZIL (level 3)
        |-- Area_010 (level 4)


How do I move all assets under level 3 to level 1 ?

I tried the genAI asisstant but it give me mytree.children() which is an attribute that doesn't exist in Spy.



Link to comment
Share on other sites

  • Seeq Team

Hi JDLom,

You can move assets using the move method.  This is covered in the Spy Documentation under Asset Tree 1 - Introduction for reference.

Here is an example of moving Area A asset to My CSV Tree:


Example of what your script may look like:

             destination='GBR Wonderware')


Link to comment
Share on other sites

Hi Chris,
Thanks, I am familiar with the move I was just curious if there is a way to easily get a list of all children below my level 3 as Area_010 is not the only one, there are + 100 other children there. Once I have that list I can loop it over.





Link to comment
Share on other sites

  • Seeq Team
  • Solution

You can execute a spy.search at your level 3 for assets and then create a list of all the assets.  

asset = spy.search({'Path': 'GBR Wonderware >> Public Groups >> PBLEINER_BRAZIL', 'Type':'Asset'})
asset_list = asset['Name'].tolist()

for asset in asset_list:
                destination="GBR Wonderware")



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...