# Delete instance of Flex Repeater using a button script

**URL:** <https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [March 27, 2022, 10:36pm UTC](https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690 "2022-03-27T22:36:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [March 27, 2022, 10:36pm UTC](https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690/1 "2022-03-27T22:36:54Z")

</div>

![Flex container](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/d/9d68c3ea31691bd90fd7ccf92cbd288d8d59d40f.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/4/e415e6f2748b988e7c0bf56feec7a14698b9b732.png)

Hello, I need help please.

I would like to delete instances of my Flex Repeater using a button. In fact when I click on the delete button, the instances must be deleted

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 28, 2022, 1:32am UTC](https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690/2 "2022-03-28T01:32:53Z")

</div>

You need to recreate or modify the `props.instances` object.

Tip: I think your design could benefit from some of the ideas in the [RealPars Responsive HMI Design](https://youtu.be/5GEvFF8pGlc) video series. The screenshot above is difficult to read.

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [March 28, 2022, 7:55am UTC](https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690/3 "2022-03-28T07:55:54Z")

</div>

I created Flex container and a flex Repeater.  
What I would like is when I click the button on delete on flex repeater, the created instance should be deleted.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0dc04ac6681896c593a1ed02f558bb49d367ce1d.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 28, 2022, 8:18am UTC](https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690/4 "2022-03-28T08:18:29Z")

</div>

Yes, so you need to recreate the flex repeater’s `props.instances` without the view you want to delete.

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [March 28, 2022, 8:25am UTC](https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690/5 "2022-03-28T08:25:16Z")

</div>

This is my problem; I don’t know how I can create it.

---

<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:** [March 28, 2022, 3:19pm UTC](https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690/6 "2022-03-28T15:19:33Z")

</div>

How do you currently know how many motor views you need?  
That value should be connected to a binding.  
Your delete button should ‘tell’ that source count to reduce itself, in some way.

Or, you shouldn’t _delete_ anything, and just have the delete button set `display` to `False` on the view in your repeater.

---

<div class="post-metadata">

**Author:** ![gopinath.ps](https://avatars.discourse-cdn.com/v4/letter/g/7ea924/32.png) [@gopinath.ps](https://forum.inductiveautomation.com/u/gopinath.ps)\
**Post date:** [August 3, 2022, 6:14pm UTC](https://forum.inductiveautomation.com/t/delete-instance-of-flex-repeater-using-a-button-script/57690/7 "2022-08-03T18:14:36Z")

</div>

```
del self.getSibling("FlexRepeater").props.instances[0]

```

this seem to work for me.
