Create a dynamic view on the same page using Flex Repeater

Hi everyone, I’m new to Ignition Perspective.

On the main page, I have a dropdown with two options: siteA and siteB. Each site has a different number of components. For example, siteA has one component and siteB has two components. Each component has two fields: nameDevice and value.

I have created the view of components on each site. Then I want to use Flex Repeater to repeat the number of components for each site. With the design above, when the user chooses siteA from Dropdown, the page will display all siteA’s components, similar to siteB.
I know the best way to solve it is to write a script that returns an array of object. But I still do not know how to write the code.

Thank you so much for your time!

This should get you started^^ just gotta adjust the params to the right names

instances=[]
	if value == 'siteA':
		instances.append({'something':'a','param2':'1'})
	elif value == 'siteB':
		instances.append({'something':'b','param2':'2'})
		instances.append({'something':'c','param2':'3'})
	return instances

1 Like

Yeah, it’s really helpful. Thanks for your support!

1 Like