# Dynamic Flex Repeater - dataset binding with instances

**URL:** <https://forum.inductiveautomation.com/t/dynamic-flex-repeater-dataset-binding-with-instances/37930>\
**Category:** Ignition\
**Created:** [August 19, 2020, 10:27pm UTC](https://forum.inductiveautomation.com/t/dynamic-flex-repeater-dataset-binding-with-instances/37930 "2020-08-19T22:27:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yfactor](https://avatars.discourse-cdn.com/v4/letter/y/e79b87/32.png) [@Yfactor](https://forum.inductiveautomation.com/u/Yfactor)\
**Post date:** [August 19, 2020, 10:27pm UTC](https://forum.inductiveautomation.com/t/dynamic-flex-repeater-dataset-binding-with-instances/37930/1 "2020-08-19T22:27:36Z")

</div>

Hi there I am trying to bind a dataset to a flex repeater instances.  
I have the same problem as

> [@Dynamic Flex Repeater Instances](http://forum.inductiveautomation.com/t/dynamic-flex-repeater-instances/30472/2):
>
> As the error states, the params for each instance are expected to be an object. try: x = [] for row in range(value.getRowCount()): y = {} cols = ["partnum", "qtyscheduled", "note"] for i in range(value.getColumnCount()-1): y[cols[i]] = value.getValueAt(row, i) x.append(y) self.props.instances = x return self.props.instances Note: I didn’t run this myself, but this will turn your inner list into a dictionary (object), which is the structure expected for each instance’s params.

first I got Object found Array expected error  
so I put in the script  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/5/f5b4419f09943d795322623f00a0bcd360037597.png)

and now I got the array found and object not found.

I am not familiar with this perspective and would appreciate if someone can show me how I can fix this?  
Thanks

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 20, 2020, 1:31am UTC](https://forum.inductiveautomation.com/t/dynamic-flex-repeater-dataset-binding-with-instances/37930/2 "2020-08-20T01:31:30Z")

</div>

`cols` in line 5 is being overwritten by the integers from `range()`` in line 6.

---

<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:** [August 20, 2020, 3:57pm UTC](https://forum.inductiveautomation.com/t/dynamic-flex-repeater-dataset-binding-with-instances/37930/3 "2020-08-20T15:57:28Z")

</div>

A few of things about your script:

1. @pturmel is correct about your `cols` variable being overwritten.
2. You also don’t need to “manually” set the property to which you are applying this binding result.
3. You’re getting object not found because you’re making a list of lists, when you really want a list of objects.

```auto
	instances = []
	column_headers = system.dataset.getColumnHeaders(value)
	for row_index in range(value.getRowCount()):
        # Right here you want an object/dict - not a list
		row_data = {}
		for column_index in range(value.getColumnCount() - 1):
		    row_data[column_headers[column_index]] = value.getValueAt(row_index, column_index)
		instances.append(row_data)
    # note here that I am simply returning the instances, instead of assigning them
    # directly to the property
	return instances

```

---

<div class="post-metadata">

**Author:** ![Yfactor](https://avatars.discourse-cdn.com/v4/letter/y/e79b87/32.png) [@Yfactor](https://forum.inductiveautomation.com/u/Yfactor)\
**Post date:** [August 20, 2020, 7:47pm UTC](https://forum.inductiveautomation.com/t/dynamic-flex-repeater-dataset-binding-with-instances/37930/4 "2020-08-20T19:47:07Z")

</div>

Gotcha,  
Thank you for the neat step by step explanation. and also thank you @pturmel.  
Yes it worked and I now see how it is structured and how to manipulate it.  
I just started with Perspective with minimal knowledge but I am starting to like it 😃 👍 Not as intimidating as i thought The presentation and sizing are cool with Perspective compare to Vision.  
Cheers
