JDLom Posted May 22 Share Posted May 22 Hi, 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 More sharing options...
Seeq Team Chris Harp Posted May 22 Seeq Team Share Posted May 22 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: mytree.move(source='Area_010', destination='GBR Wonderware') Link to comment Share on other sites More sharing options...
JDLom Posted May 22 Author Share Posted May 22 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. kr, Jan Link to comment Share on other sites More sharing options...
Seeq Team Solution Chris Harp Posted May 22 Seeq Team Solution Share Posted May 22 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: mytree.move(source=asset, destination="GBR Wonderware") mytree.visualize() Link to comment Share on other sites More sharing options...
JDLom Posted May 23 Author Share Posted May 23 Awesome, thanks Chris! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now