# Filtering Template on Repeater Template of main windows

**URL:** <https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [November 19, 2023, 10:18am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099 "2023-11-19T10:18:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 19, 2023, 10:18am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/1 "2023-11-19T10:18:48Z")

</div>

I'm used to working on the perspective module but on VISION I'm having trouble getting by

In fact, I created a template view with **Custom params** : **city** , **visibility** (False/True), **num\_turbine** , **state**.

I instantiate this on a main view.  
I instantiated 2 templates (turbine 1 and turbine 2), but I added two checkboxes (turbine 1 and turbine 2) on the main view.

What I want is that : when I click on checkox turbine 1, the tempate turbine 2 should be invisible using **custum visibility of template**

Tempalte:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/8/b87a682116053e3ebf0abbb0e9ab23a2b5e3d114.png)

This the main windows:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/f/2f16afb9430ace050478b64cb68558d7007191f1.png)

on dataset of image bellow, if I set visibility = False where egine\_num = 1, **Wind Energie Turbine 1** will because invisible. But I want do it using checkbox.

The idea that I have is to create a loop whent I clique to checkbox 1, I will loop dataset to update value of visibility column of dataset. But I don't know if it is will work.

My english is not good sorry! 😀

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 19, 2023, 11:18am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/2 "2023-11-19T11:18:29Z")

</div>

1. Do you want only one turbine at any time?
2. Or do you want to be able to display more than one at the same time?

If 1, then you should be using radio buttons, not checkboxes.

[https://docs.inductiveautomation.com/display/DOC81/Vision+-+Radio+Button](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Radio+Button)

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 19, 2023, 3:04pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/3 "2023-11-19T15:04:16Z")

</div>

Yes I want one turbine at time.

I can use radio buttons but I don't know how to define the link between the radion button and the data that is in the Template Repeater table

Column visibility must be dynamic with radion button

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 19, 2023, 4:43pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/4 "2023-11-19T16:43:34Z")

</div>

You bind the `visible` property of the item you want to display / hide to the radio button's `selected` property.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 20, 2023, 2:20am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/5 "2023-11-20T02:20:16Z")

</div>

> [@sebastien\_ng](#):
>
> I don't know if it is will work.

I don't imagine this will work as expected. If you are using a repeater in dataset mode, the template is going to be displayed if it is included in the dataset. Binding the visibility of the template's internal components to a custom property will only create gaps in the repeater.

What you probably want to develop is a custom method on the repeater that the checkboxes can call on an actionPerformed event to reevaluate the templateParams dataset.

**Example:**  
_Simple test template with label bound to a number property:_  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/6/56201b574453b04089d4df568614f8017f41bbe4.png)

_templateParams property with a column that represents the Number parameter:_  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/2/220a04168d3b98f2bd4c46055913fc5b3cac3182.png)

_All checkboxes in a container, and each checkbox has a custom property to signify which template it represents:_  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c0726f314e7785f0b29c62e26801b1a40c0a1e75.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/6/76091d85065cc9a90b51d714b2a6c8fdac6cdc0f.png)

_Custom Method on Template Repeater to reevaluate the dataset when the checkboxes are clicked:_  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/6/5672724fdf1f69d6f02df24c4bf34dc98ac79ae2.png)

```auto
#def evaluateDataset(self):
	# Get the container that contains the checkboxes
	checkboxGroup = self.parent.getComponent('Checkbox Group')
	
	# Create headers and data lists for the template parameters dataset
	headers = ['Number']
	data = []
	
	# Iterate through the checkboxes in the container and check to see if they are selected
	for index, component in enumerate(checkboxGroup.getComponents()):
		if component.selected:
			
			# If they are selected, add the template number they represent to the template parameters data list
			data.append([component.TemplateNumber])
			
	# Convert the data and headers lists into a dataset
	dataset = system.dataset.toDataSet(headers, data)
	
	# Sort the dataset, so the templates appear in the appropriate order
	# ...and assign the dataset to the repeater's templateParams property
	self.templateParams = system.dataset.sort(dataset, 'Number')

```

_Call the custom method using each checkbox's actionPerformed event script:_

```auto
# Call the custom method that evaluates the template repeater's dataset
event.source.parent.parent.getComponent('Template Repeater').evaluateDataset()

```

**Result:**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/8/284374b4ab8839e96331831f06d90b5c4a560d7f.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 20, 2023, 3:15am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/6 "2023-11-20T03:15:25Z")

</div>

According to Sebastio only one template is to be displayed at a time. That's why I recommended radio buttons.

Now I'm wondering why he thinks he needs a flex repeater!

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 20, 2023, 3:26am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/7 "2023-11-20T03:26:34Z")

</div>

I imagine something was lost in translation there. It looks like he just wants to use check boxes to filter which turbine engines are displayed.

Hopefully the tutorial will be enough to get him unstuck.

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 21, 2023, 10:22am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/8 "2023-11-21T10:22:54Z")

</div>

hello @justinedwards.jle thank you for your proposition.

I Think my explication was not clear.

What I want is like: when Radio Button 2 is True, template 2 muste be invisble.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/8/289b80a6decb72ed082c8139173ead877fa38ac6.png)

That is mean, when I check Radio Button 2, all value of column **visibility** of Template Repeater must be True.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 21, 2023, 11:57am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/9 "2023-11-21T11:57:12Z")

</div>

Hang on, radio buttons or checkboxes? These have completely different function. Radio buttons are for selecting a single option. Checkboxes are for toggling multiple options independently of one another  
Eg.  
Choosing your gender would be a radio button  
Choosing your favourite icecreams would be checkboxes to let you select more than one

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 21, 2023, 1:00pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/10 "2023-11-21T13:00:02Z")

</div>

> [@nminchin](#):
>
> radio buttons

I chose to use radio button because I will select one option

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 21, 2023, 1:06pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/11 "2023-11-21T13:06:42Z")

</div>

What's not clear to me is this: Do you want the turbine that is selected by the radio button to be visible and all of the others hidden, **or** do you want the one that is selected to be hidden, and all of the others visible?

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 21, 2023, 1:08pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/12 "2023-11-21T13:08:21Z")

</div>

> [@justinedwards.jle](#):
>
> Do you want the turbine that is selected by the radio button to be visible and all of the others hidden

Turbine that is selected by the radio button to be invisible and all of the others visible

---

<div class="post-metadata">

**Author:** ![leonardo.godoi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/leonardo.godoi/32/27178_2.png) [@leonardo.godoi](https://forum.inductiveautomation.com/u/leonardo.godoi)\
**Post date:** [November 21, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/13 "2023-11-21T13:26:37Z")

</div>

If you're not going to show more than one template at a time, if you won't repeat the template then i would just use the normal template with a binding on the property engine\_num to change it based on the selected button

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 21, 2023, 1:30pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/14 "2023-11-21T13:30:33Z")

</div>

Turbine selected = Template invisible  
All of the others not seleted will be visible

---

<div class="post-metadata">

**Author:** ![leonardo.godoi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/leonardo.godoi/32/27178_2.png) [@leonardo.godoi](https://forum.inductiveautomation.com/u/leonardo.godoi)\
**Post date:** [November 21, 2023, 1:34pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/15 "2023-11-21T13:34:28Z")

</div>

Something kind of like this?  
 ![java_QnjJB04Iv9](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/1/b113815bf50413c4e8d4454b75acf9bacf2f62ec.gif)

```auto
if({Root Container.Radio Button 1.selected},2,
if({Root Container.Radio Button 2.selected},3,1))

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 21, 2023, 1:41pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/16 "2023-11-21T13:41:40Z")

</div>

> [@sebastien\_ng](#):
>
> Turbine that is selected by the radio button to be invisible and all of the others visible

IMO this is not intuitive to the user, but then I also don't know your application so perhaps it makes since in context. Generally, an operator will select what they _ **want** _ to see, not what the _ **don't** _ want to see.

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 21, 2023, 1:43pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/17 "2023-11-21T13:43:24Z")

</div>

yes that is good I also think do it.

The Radion button must be on the main windows(on Template Repeater like exemple above) and no on template.

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 21, 2023, 1:46pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/18 "2023-11-21T13:46:37Z")

</div>

😊@lrose Is True what are you talking but on my projet Turbine selected must be invisible

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 21, 2023, 2:14pm UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/19 "2023-11-21T14:14:18Z")

</div>

Assuming you have a template parameter for the visibility, bind the visible property of what you "don't" want to show with an expression binding of the inverted template parameter.

```expression
!visiblity

```

Then use a cell update binding on the Template Parameters dataset to bind the radio buttons to the visibility column of the parameters.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d2cae5ec1a05c9e39b9e583f1ac46ca83f34d715.png)

Insure that your radio buttons are all in a group together. Now your visibility will change with your selection.

![fans](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/f/af3113b4a7a507128e8a8a3aca5a47e62c6d98bf.gif)

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [November 23, 2023, 10:59am UTC](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099/20 "2023-11-23T10:59:13Z")

</div>

thank you @lrose

[Next page](https://forum.inductiveautomation.com/t/filtering-template-on-repeater-template-of-main-windows/82099.md?page=2)
