Binding a template within a template

So I am trying to figure out if this is something that Ignition can do.

I have a template that grabs information like name, description, source and destination from a UDT tag. Then these are grouped together in groups of 15.

I was hoping I could create a Template with one of these and then create another template with this template 15 times. And then on a screen have this template with 15 show up and be able to pass all 15 UDTs through it.

I hope I am making sense but wondering if this is possible

I don’t see why not. Sounds like a job for a template repeater, though, and indirect binding (avoiding UDT properties).

How would I go abouts doing it this way?

The template would have a string template property called ‘tagpath’ or something like that, and internal properties where needed that use indirect binding to pull in the tag values you need. Potentially with bidirectional bindings for writing back.

In the template repeater, I would then use its dataset mode to supply the appropriate tagpath strings. (The dataset would have 15 rows and one column–named tagpath.)

Ok wow I didnt know it was that easy. Thank you.

Now what if I wanted to run a repeater within a repeater is that something that can be done? As I need to have this group of 15, 20 times.

Here is how I did something similar. Substitute your info as needed.

Setup a screen called ‘Station_Info’ in the ‘General’ windows folder and add custom properties ‘templateType’ (string) and ‘params’ (dataset)

Add a template repeater to the ‘Station_Info’ screen and bind the template path property to the custom property ‘templateType’ on the ‘Station_Info’ screen. Bind the template parameter property to the custom property ‘params’ on the ‘Station_Info’. Use the following script to open ‘Station_Info’ and send your dataset with more params to the screen.

def goToStationInfo(nodeNumber, stationName, templateType):
    #Close open windows.
    navigation.closeWindows()

    #Create dataset to pass to template screen.
    header = ['node', 'station']
    data = []
    data.append([nodeNumber, stationName])
    ds = system.dataset.toDataSet(header, data)

    #Assign Menu screen the proper node.
    Menu = system.gui.getWindow('Menu')
    Menu.rootContainer.node = nodeNumber
    #Open the requested window.
    system.nav.openWindow('General/Station_Info', {'node' : nodeNumber, 'station' : stationName, 'templateType' : templateType, 'params' : ds})

Exactly the same as Phil said, except now you have a template that has the template repeater in it, and the outer most template repeater will repeat the template with the template repeater :slight_smile: in the template with the template repeater, you would use a cell update binding to set the 15 rows’ tagpaths to make them customisable in the outer template repeater. This new template would have a template param called equipId or something which then you would set in the outer template repeater dataset

Beware of nightmares about questions like “How many repeaters can a repeater repeat when nested in a repeating repeater?”

:hot_face:

1 Like

Haha! Thank you guys! Everything worked exactly as I wanted it to. And saved me hours of work!