# Flex repeater and instances

**URL:** <https://forum.inductiveautomation.com/t/flex-repeater-and-instances/67094>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 30, 2022, 4:54pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-and-instances/67094 "2022-11-30T16:54:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![christopher\_wray](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@christopher\_wray](https://forum.inductiveautomation.com/u/christopher_wray)\
**Post date:** [November 30, 2022, 4:54pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-and-instances/67094/1 "2022-11-30T16:54:24Z")

</div>

I have a bit of an issue,

I have a flex repeater, with a query binding. I have a script transform, which has some conditional syntax  
depending on the conditions. For example

test1\_instance.append(test)  
test2\_instance.append(test2)

my issue is for example, if I return test1\_instance, it will show the correct number of instances, and vice versa for test2\_instance.

but I want to show both in one list

if i do this  
return test1\_instance,test2\_instance

what this does is whatever is first, for example:  
test1\_instance it will display the correct number instances but the test2\_instance it will create the  
instance ok but then all the results of that instance become members of that instance, instead of creating an Instance

sorry if this is confusing

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 30, 2022, 5:00pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-and-instances/67094/2 "2022-11-30T17:00:10Z")

</div>

`return test1_instance,test2_instance` is returning a tuple.

You probably want:  
`return test1_instance + test2_instance`

---

<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:** [November 30, 2022, 5:01pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-and-instances/67094/3 "2022-11-30T17:01:38Z")

</div>

A Flex Repeater displays multiple instances of ONE View. The number of instances is determined by ONE list: `FlexRepeater.props.instances`. Your code leads me to believe you're trying to use two different lists to store your instances, but you also claim some conditional logic while supplying none.

Try adjusting your logic in the transform to follow a pattern like this:

```auto
instances = []
for entry in value:
    instance_obj = {}
    # add some key:value pairs to your object based on the entry
    instances.append(instance_obj)
return instances

```

---

<div class="post-metadata">

**Author:** ![christopher\_wray](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@christopher\_wray](https://forum.inductiveautomation.com/u/christopher_wray)\
**Post date:** [November 30, 2022, 5:03pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-and-instances/67094/4 "2022-11-30T17:03:56Z")

</div>

cheers that work. thanks.
