One master window to receive different templates and control those child parameters/tags

Good morning people, I’m having some fun with Ignition, it’s a great tool.

I was thinking if it’s possible to have one window to receive a template as a parameter, like in the image attached.

That way I can control the templates (child) internal tags on the main window, like open or close the valve.

Thanks.

vision or perspective?

TL;DR: You can do it if you treat your whole window as a template and make good use of the template component’s “templatePath” property and a well organized tag provider will help you a lot.

Using Vision i’ve made a similar window as a popup, so when the user clicks on a button, it opens the popup and specifying which template to use and it’s properties’ values, you can follow these steps and get a similar result as the one that worked for me:

  1. Assuming you have multiple “Solenoid Valve No Feedback” and need to know which one to open, add 2 custom properties to you window’s root container, one specifying the template type(Which is just the valve type) and another for you to find the specific valve, maybe it’s tag address or part of it for example. I’ll call these properties templateType and templateTagPath from now on.

  2. Add a template component with it’s “templatePath” property bound to your root container property you’ve created called templateType, so the value you pass to this property must be equal to the name of the template you plan on using and the template must have it’s Template property bound to the window’s root container templateTagPath.

  3. On your drawing you have 2 buttons to open and close, i would suggest you include those in your template for consistency, but if you must have them outside, you can just use an indirect tag binding using the root container’s properties to find your specific valve.

  4. Now you just have to worry about how you open the window and change parameters, in my case i have a screen with all the buttons that lead to the popup and they’re grouped by their templateType and each one has the respective tag name as the button’s name, so their script is all the same, they just open the popup and send their parent’s name and their own name to the popup’s root container.

If my english isn’t clear enough i can try to explain these steps better.

2 Likes

Great, but how can I select any property/parameter “data type” as of the template type?

If i understood you correctly, you can bind the templatePath parameter of the template component on your window directly to the root container’s custom property you should’ve added.
The custom property name doesn’t matter, but it’s datatype is supposed to be a string containing the exact name of the template you want to be displayed on your screen, so if your root container’s property changes, it changes the tamplate being displayed.
I have mine setup like this:

I’ve understood so far, but how did you pass the String (Template Path) to the container so it can be dynamically added to the container?

I mentioned that i have i window with all the buttons that lead to my popup, and those buttons all have a script similar to this:

InputType = event.source.parent.name
#Grabs the inputType from the parent container, this will be my templatePath

NomeTag = event.source.name
#Grabs the name of the button, which coincides with my tag name
#It's better if you use a custom string property for this since
#Component names have restrictions.
#This will be my templateTagPath.

popupDict: {'InputType' : InputType,'TagNomeSelecionado' : NomeTag,'Temperaturas':True}
window = system.nav.openWindow('Configuracoes/Input Config Popup', popupDict)
#This is the important part, the openWindow function lets you pass a dictionary
#where the keys correspond to params on the  root container of the window you
#want to open
1 Like