# Perspective Flex Repeater Instances Updation

**URL:** <https://forum.inductiveautomation.com/t/perspective-flex-repeater-instances-updation/65505>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 21, 2022, 4:08am UTC](https://forum.inductiveautomation.com/t/perspective-flex-repeater-instances-updation/65505 "2022-10-21T04:08:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_John](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@John\_John](https://forum.inductiveautomation.com/u/John_John)\
**Post date:** [October 21, 2022, 4:08am UTC](https://forum.inductiveautomation.com/t/perspective-flex-repeater-instances-updation/65505/1 "2022-10-21T04:08:25Z")

</div>

I have created Flex repeater with checkbox template. On change of checkbox, message handler is called. In the message handler received I am fetching the flex repeater instances. But Flex repeater instance updating after 0.5 sec of check box change. Please help me to solve the issue.

Thanks

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [October 21, 2022, 1:59pm UTC](https://forum.inductiveautomation.com/t/perspective-flex-repeater-instances-updation/65505/2 "2022-10-21T13:59:32Z")

</div>

> In the message handler I am fetching the flex repeater instances.

Usually, this is what I would do to get instant Flex Repeaters `instances` modification:

1. Create view to be repeated (your checkbox template). Add a view param called `index` on your checkbox view. Add another view param called `value`. Bind the Checkbox's `selected` property to `self.view.params.value`.
2. Create a different view with Flex Repeater in it. Set the path to the first view from step 1. Add some test instances. **DON'T pass in the `index` parameter from the Flex Repeater, it'll get passed in automatically!!! (read docs for Flex Repeater).**
3. Create a Message Handler on the Flex Repeater, call it something like `update_instance` and keep the scope at `page`. In this message handler, you'll be listening for checkbox changes and update the correct one with a script like this:

```python
index = payload["index"] # index of instance to modify
value = payload["value"] # new value (either True/False, 0/1, etc)

# update the instance with new state of checkbox
self.props.instances[index].value = value

```

1. Go back to the view with the Checkbox. On the Checkbox component, add a script on the `onActionPerformed` event and place this there:

```python
payload = {
    "index": self.view.params.index,
    "value": self.props.selected
}

system.perspective.sendMessage("update_instance", payload)

```

Now if you go back to your view with the Flex Repeater, focus on the Flex Repeater in the Project Browser and hit the Preview mode, you'll be able to change the checkboxes in the Flex Repeater and they'll change instantly in the `instances` list.

[Doing this all from memory so if something doesn't work, let me know and I'll correct it!]

---

<div class="post-metadata">

**Author:** ![John\_John](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@John\_John](https://forum.inductiveautomation.com/u/John_John)\
**Post date:** [October 25, 2022, 8:31am UTC](https://forum.inductiveautomation.com/t/perspective-flex-repeater-instances-updation/65505/3 "2022-10-25T08:31:55Z")

</div>

It's working... Thank you so much
