JDLom Posted May 22, 2024 Posted May 22, 2024 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.
Seeq Team Chris Harp Posted May 22, 2024 Seeq Team Posted May 22, 2024 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')
JDLom Posted May 22, 2024 Author Posted May 22, 2024 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
Seeq Team Solution Chris Harp Posted May 22, 2024 Seeq Team Solution Posted May 22, 2024 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()
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