# Flex Repeater Instances

**URL:** <https://forum.inductiveautomation.com/t/flex-repeater-instances/59791>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [May 19, 2022, 3:41pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-instances/59791 "2022-05-19T15:41:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwilliams](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jwilliams](https://forum.inductiveautomation.com/u/jwilliams)\
**Post date:** [May 19, 2022, 3:41pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-instances/59791/1 "2022-05-19T15:41:49Z")

</div>

I am using Ignition v8.1.5. I am trying to create a binding that would allow a user to set a value that would create a set of instances without having to go through each and every single instance creation manually.  
I basically have a set of offshoots stacked horizontally like the image below using a Flex Repeater and a path that uses a template offshoot. Here I have 27 for an example but sometimes there are hundreds and creating each extra instance when there are that many gets extremely tedious and slow. Is it possible to create a binding of some kind that allows a user to set a value such as “OffshootCount: 100” and then 100 instances be created within the flex repeater?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/5/8512694937fc288e23e32477bb4fd459b977c195.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [May 19, 2022, 4:00pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-instances/59791/2 "2022-05-19T16:00:01Z")

</div>

You could have a number entry field where the user enters the amount of instances that they would like. You then bind the flex repeater instances property to that number field value and add a transform script where it builds the needed data for each instance.

transform script would be:

```auto
	if value > 0:
		instances = [{'instanceStyle':{'classes':''}, 'instancePosition':{}} for x in xrange(value)]
	else:
		instances = []
	
	return instances

```

which should give the flex repeater the most basic values for each instance. If you have additional values that need to be passed to the instances, they need to be included in this part: `{'instanceStyle':{'classes':''}, 'instancePosition':{}}`. Just add the additional dictionary keys and values.

---

<div class="post-metadata">

**Author:** ![jwilliams](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jwilliams](https://forum.inductiveautomation.com/u/jwilliams)\
**Post date:** [May 19, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-instances/59791/3 "2022-05-19T16:05:56Z")

</div>

That works perfectly!

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 20, 2022, 9:29am UTC](https://forum.inductiveautomation.com/t/flex-repeater-instances/59791/4 "2022-05-20T09:29:54Z")

</div>

Why check for `value > 0` ?

```python
[{} for _ in range(0)]

```

should already return an empty list.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [May 23, 2022, 3:05pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-instances/59791/5 "2022-05-23T15:05:04Z")

</div>

Prevent it from running on a negative number entry.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 23, 2022, 3:16pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-instances/59791/6 "2022-05-23T15:16:02Z")

</div>

passing a negative number to range also results in an empty list:

```python
[{} for _ in range(-3)]

```

> `[]`
