# Help with indexing flex repeater instances component dataset?

**URL:** <https://forum.inductiveautomation.com/t/help-with-indexing-flex-repeater-instances-component-dataset/56082>\
**Category:** Ignition\
**Created:** [February 13, 2022, 6:43pm UTC](https://forum.inductiveautomation.com/t/help-with-indexing-flex-repeater-instances-component-dataset/56082 "2022-02-13T18:43:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdixon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pdixon/32/6899_2.png) [@pdixon](https://forum.inductiveautomation.com/u/pdixon)\
**Post date:** [February 13, 2022, 6:43pm UTC](https://forum.inductiveautomation.com/t/help-with-indexing-flex-repeater-instances-component-dataset/56082/1 "2022-02-13T18:43:30Z")

</div>

I obviously don’t know enough about dataset and attributes of components, so I need some help.

I have a flex repeater with the path set to a view with a checkbox. I have a button that is intended to step through the text boxes and see which ones are selected. If I look at the Instances parameter on the flex repeater with logger messages:

```
Instances = self.getSibling("FlexRepeater_Obj").props.instances
logger.info("list" + str(Instances))
logger.info("list[0]" + str(Instances[0]))	

```

i get:

```
  list<ArrayWrapper>: [<ObjectWrapper>: {u'text': u'dan', u'selected': False}, 
  <ObjectWrapper>: {u'text': u'jill', u'selected': False}, <ObjectWrapper>: 
  {u'text': u'NOTA', u'selected': False}]

  list[0]<ObjectWrapper>: {u'text': u'dan', u'selected': False}

```

Now what I want to do is look at each column in Instances[0]. I assume I would index this at Instances[row][column]. However, when I try to look at Instances[0][0] like this:

```
Instances = self.getSibling("FlexRepeater_Obj").props.instances
logger.info("list" + str(Instances))
logger.info("list[0]" + str(Instances[0]))	
logger.info("list[0][0] " + str(Instances[0][0]))

```

i get an error on the last line:

```
list<ArrayWrapper>: [<ObjectWrapper>: {u'text': u'dan', u'selected': False}, 
   <ObjectWrapper>: {u'text': u'jill', u'selected': False}, <ObjectWrapper>:
   {u'text': u'NOTA', u'selected': False}]

list[0]<ObjectWrapper>: {u'text': u'dan', u'selected': False}

Error running action 'dom.onClick' on 
    View_001@C$0:1/root/Button_CastBallot: Traceback (most 
    recent call last): File "<function:runAction>", line 14, in runAction 
    KeyError:0

```

How do I reference the ‘selected’ column in each row to see if the value is true or false? I have tried toPyDataSet() and toDataSet() but neither helps.

---

<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:** [February 13, 2022, 7:11pm UTC](https://forum.inductiveautomation.com/t/help-with-indexing-flex-repeater-instances-component-dataset/56082/2 "2022-02-13T19:11:58Z")

</div>

Well, what might help clear the waters a bit, is that it isn’t a dataset. But a **List** of **Objects** with attributes. So you reference it that way.

```python
Instances = self.getSibling("FlexRepeater_Obj").props.instances
logger.info("list[0].text" + Instances[0].text)
logger.info("list[0].selected" + str(Instances[0].selected))

```

So if you wanted to loop through the repeater and record which instances were selected, one way to do that is:

```python

Instances = self.getSibling("FlexRepeater_Obj").props.instances
selInst = []
for instance in Instances:
    if instance.selected:
        selInst.append(instance.text)

```

And of course you could do that condensed into a comprehension if you wished as well

```python
Instances = self.getSibling("FlexRepeater_Obj").props.instances
selInst = [instance.text for instance in Instances if instance.selected]

```

---

<div class="post-metadata">

**Author:** ![pdixon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pdixon/32/6899_2.png) [@pdixon](https://forum.inductiveautomation.com/u/pdixon)\
**Post date:** [February 22, 2022, 2:51am UTC](https://forum.inductiveautomation.com/t/help-with-indexing-flex-repeater-instances-component-dataset/56082/3 "2022-02-22T02:51:59Z")

</div>

Thank you, perfect!
