Embedding a view within itself

From the title you’ve probably already formed a strong opinion about what I’m trying to do, but hear me out :grin:

My projects are structured in groups. There is a group UDT which controls the operation of all equipment within that group. So, you put the group in auto, and all the motors, valves, etc contained within that group will (assuming they individually are also in auto) run in the intended automatic manner. This is all done at the PLC level.

In the PLC, there is a group UDT which contains all the controls for managing this group. The UDT also appears in Ignition. I then have a sidebar which I can call for any instance of a group UDT, which will show all the relevant controls (e.g. Auto/Off/Manual), status information (e.g. group interlocks, group safety zone status), settings and alarms associated with that group. It works quite well.

However, sometimes, my groups have sub-groups. For example, I might have a “storage” group, within which are four silos. The “storage” group controls the operation of the storage system in its entirety, while each silo sub-group controls the operation of all equipment associated with one of the four silos. In this manner I can shut the whole system down by turning the storage group off, or just take one silo out of service for commissioning by turning just that silo’s sub-group off.

In these cases, I would like my sidebar to show the overall group controls at the top, and then in the space below, a tab container in which I can select any one of the four sub-groups to show their sub-group controls. And of course, because I hate doing things twice when I can do them once, all I want to do is embed the existing group controls view into each tab of the tab container.

Okay, fair enough, I understand that if I did this carelessly, there would be infinite nested views and I would crash something. However, when I call the group sidebar, I have to pass in a parameter to determine whether or not this particular group has sub-groups. By default, this parameter is false. If I do not specifically call out the fact that this group has sub-groups, the sub-groups embedded display is not displayed. So, all I have to do is specify when I call certain groups that they have sub-groups, but in the embedded view for my subgroups, specify that those sub-groups do not have sub-groups.

It doesn’t work, of course - I just get a view error “view cannot be nested in itself”. Okay, fine, I understand that’s probably a necessary feature!

So my question, after all that preamble, is - can anyone think of a creative way to solve this problem? All I can currently think to do is to create a “subgroup” view which is a direct copy-paste of the “group” view. But again, I hate doing things twice, and then I have to maintain two views going forward instead of one. So if anyone on here is feeling adventurous and can think of some creative ways around this limitation, I’d love to hear it!

No ideas, but to sync if they’re identical you could just shift+right click on view, copy json, shift right click on copy view, past json

Perspective right?
With a canvas container you can programmatically create a view of your ‘group’ and with some param determine if it has ‘subgroups’ to display the view again but a bit lower…

But that is going to be more work than just copy pasting xD

1 Like

Or embed a flex repeater, perhaps?

1 Like

Along the lines @victordcq suggested, make your nestable view just handle the one group. Then make a wrapper view that nests one group at the top, and the tab container below it. The wrapper would take a parameter for the top group, and a list parameter for the subgroups. Hide the tab container when the list is empty.

1 Like

Thanks everyone. With the suggestions above and a good night’s sleep, I realised I was overthinking it - I just created a “group sidebar” view, which embeds two views: a “group controls” view, and a “subgroups” view, which is a tab container, each tab containing another embedded “group controls” view. So I’m no longer embedding a view within itself; I’m just embedding 1-n copies of a view into a different view.

2 Likes