Filtering Template on Repeater Template of main windows

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


This the main windows:

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! :grinning:

  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.

1 Like

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

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

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.

Simple test template with label bound to a number property:

templateParams property with a column that represents the Number parameter:

All checkboxes in a container, and each checkbox has a custom property to signify which template it represents:

Custom Method on Template Repeater to reevaluate the dataset when the checkboxes are clicked:

#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
	# 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:

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


1 Like

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!

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.

1 Like

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.

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

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
Choosing your gender would be a radio button
Choosing your favourite icecreams would be checkboxes to let you select more than one

1 Like

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

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?

1 Like

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

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

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

Something kind of like this?

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

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.


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.

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

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.


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

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



thank you @lrose