Is root iterable?

Hi everyone, I'm trying to implement a feature that needs to go through view's items and with each item, I need to go through its props.

Initially, I thoguht I could be able to handle it with a OnStartUp Event, and use a script for it, using something like:

	aux_list = []
	for item in view:
		try:
			aux_list.append(item['props']['params']['tag'])
			  #Here I'm trying to access the item's props/params/tag
 		except:
			pass
	#After that, I would be able to send this aux_list to what I want to do.

Is it possible? I found some solutions for Vision, but idk how to proceed in Perspective with it.

This may be helpful

3 Likes

Very helpful, but I didn't find a way to access the items of another view, just using the self.view.rootContainer.children, but I want to pass the view path and go through its items instead, not just the self view.

You would have to obtain a reference to the actual view instance. There's no exposed way to do that for any arbitrary view path. From a live session object, you have a getPages() method, and each Page has a getViews() method.

1 Like

image

Now I want to create a dropdown list, and its options would be a list of all views on SubSystems.

I know I could just put manually as a parameter on MainView, but this functionality of going throught the views would optmize the maintence and future upgrades.

Was there a question in there? :slight_smile:

Of course, I want to see if its possible to make a list of views as we have in Vision with system.gui.getWindowNames()

Yes, I thought it was already discussed above.
https://docs.inductiveautomation.com/display/DOC81/system.perspective.getProjectInfo

One of the keys is views.

1 Like

I'd argue that simple manually configured options/buttons make maintenance/upgrades easier than complicated scripts.They don't require as much documentation or knowledge of scripting functions.