# Access single views in a Flex Repeater

**URL:** <https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 8, 2020, 12:12pm UTC](https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140 "2020-01-08T12:12:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![petar.zurzevic](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@petar.zurzevic](https://forum.inductiveautomation.com/u/petar.zurzevic)\
**Post date:** [January 8, 2020, 12:12pm UTC](https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140/1 "2020-01-08T12:12:42Z")

</div>

I am working with perspective and using a flex repeater.  
I am repeating a simple view composed by a checkBox and 2 input parameters (text:sets the checkbox text when i create it, select:the the checbox value default to 0).  
I am trying to return the text of all the selected checkbox in the view but i can’t find a way to access the single instances in the repeater.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 8, 2020, 7:38pm UTC](https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140/2 "2020-01-08T19:38:17Z")

</div>

You can’t access the individual instances of an instanced View, but if the instanced View has the param you’re using for the checkboxes set to Input/Output, then it will write that param back to the Flex Repeater, at which point you just need to loop through the instances, and check the checkbox param property; if it is now `true` (checked), then grab the text of that instance.

---

<div class="post-metadata">

**Author:** ![petar.zurzevic](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@petar.zurzevic](https://forum.inductiveautomation.com/u/petar.zurzevic)\
**Post date:** [January 9, 2020, 3:08pm UTC](https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140/3 "2020-01-09T15:08:16Z")

</div>

Ok it works!  
Thanks for the quick answer

---

<div class="post-metadata">

**Author:** ![swox](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@swox](https://forum.inductiveautomation.com/u/swox)\
**Post date:** [September 11, 2021, 10:20am UTC](https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140/4 "2021-09-11T10:20:19Z")

</div>

Struggling a bit with this one. How do I set the param of the instance view to have the checkbox property for selected?  
Right now my view has two params:  
parameterName  
selected  
In the checkbox component I’ve done a property binding between the view param parameterName to text and another property binding between view param selected and the selected property in the checkbox component.

I’m now trying to loop through the instances of the repeater and that works, but it does not work when i want to evalutate if the selected property is set or not.

My scrip looks like this:  
for i in range(len(values.props.instances)):  
if values.props.instances[i].selected == True:

The error messages is that the object does not have the attribute selected. I’ve tried different things but can’t seem to get it right.

Please educate me, I’m obviously misunderstanding how this is supposed to work

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 11, 2021, 2:21pm UTC](https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140/5 "2021-09-11T14:21:09Z")

</div>

It would be a bit easier to help you if you posted a screenshot of the actual instance so that we could see what properties are in fact there. It would also be helpful to see the rest of your script because I have questions about what `values` refers to.

After trying this myself, I believe your approach is correct, and what is most likely occurring is you added an instance but have not added the expected `selected` property to that instance.

With this setup:  
 ![Screen Shot 2021-09-11 at 7.13.29 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/caa92e6ebbdd5295014216fec7163df0604fb293.png)

And this script:

```auto
	instances = self.getSibling("FlexRepeater").props.instances
	for i in range(len(instances)):
		system.perspective.print('Index: {0}'.format(instances[i].index))

```

My logging displayed `07:13:12.303 [Browser Thread: 57533] INFO Perspective.Designer.Workspace - Index: 3`.

Now, if I remove the `index` property from my instance, I get the following error:  
`AttributeError: 'com.inductiveautomation.perspective.gateway.script' object has no attribute 'index'`

Also, just as a point of cleaning up code, you don’t need to do direct comparisons to truth values (you also don’t need to not do them if you prefer your current approach). So you can change  
`if values.props.instances[i].selected == True:` to `if values.props.instances[i].selected:`, assuming you expect that property to always be a boolean.

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [December 28, 2021, 11:01pm UTC](https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140/6 "2021-12-28T23:01:18Z")

</div>

@cmallonee @paul-griffith I know it’s been a while but I wanted to ask this since its related to what you posted above: do any parameters get passed into the flex repeater instances by default? In a Perspective column that is set to render a view, a bunch of them are, so I was wondering if that is the case for instances.

This would help me greatly with a program I’m working on right now.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 29, 2021, 3:36am UTC](https://forum.inductiveautomation.com/t/access-single-views-in-a-flex-repeater/31140/7 "2021-12-29T03:36:40Z")

</div>

If the View which is being instanced has params with default values defined, then each instance will receive those params with the default values as long as `ViewNode.prop.inputBehavior` is set to a value of “merge”. If `ViewNode.props.inputBehavior` is set to “replace”, then your instances will only receive the params you explicitly supply yourself as params for the instance.
