# Perspective FlexRepeater custom

**URL:** <https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940>\
**Category:** Ignition Early Access\
**Created:** [May 13, 2019, 1:07pm UTC](https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940 "2019-05-13T13:07:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![souxifou](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@souxifou](https://forum.inductiveautomation.com/u/souxifou)\
**Post date:** [May 13, 2019, 1:07pm UTC](https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940/1 "2019-05-13T13:07:45Z")

</div>

Hi,

I have problem with my Flex Repeater  
I’m using a view who repeat x times in my flexrepeater, through this view i’d like to make a onclickevent wich will modify one of custom values of my flexRepeater.

But I don’t know how to acces, this is what i’ve try

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/610e068006deb1fc60193b55565060f74e2d1486.png)

This is my tree :  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a2d2123c4c0b0969ecc4ed97db79d96b8904f0f2.png)

The onclick event is on “Templatemission\Root” and my custom is on the flex repeater ( “OI/Home\_OI/FlexRepeater”)

---

<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:** [May 13, 2019, 2:04pm UTC](https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940/2 "2019-05-13T14:04:14Z")

</div>

There are two options here:

1. You can either place an outgoing param on the Templatemission View, and provide a case-sensitive matching named param for the FlexRepeater instance, which would provide your FlexRepeater access to the value form the internal View instance.
2. Whatever you are clicking in the Templatemission View could broadcast a message with `system.perspective.sendMessage()` at the page or session level, and then your Flex Repeater would then need a listener configured (right-click the FlexRepeater, then select “Configure Scripts” and create a new listener where you provide a message type key which matches the one configured in the Templatemission View).

I recommend the `system.perspective.sendMessage()` solution, as binding a FlexRepeater value against an indexed instance is not going to be fun.

---

<div class="post-metadata">

**Author:** ![souxifou](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@souxifou](https://forum.inductiveautomation.com/u/souxifou)\
**Post date:** [May 13, 2019, 2:10pm UTC](https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940/3 "2019-05-13T14:10:54Z")

</div>

> [@cmallonee](#):
>
> You can either place an outgoing param on the Templatemission View, and provide a case-sensitive matching named param for the FlexRepeater instance, which would provide your FlexRepeater access to the value form the internal View instance.

This actualy what i'v done, but not working 😕  
Because i can't get the syntax for modify the flex repeater custom from TemplateMission onclick script

I gonna try the system.perspective.sendMessage() solution, thx

---

<div class="post-metadata">

**Author:** ![souxifou](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@souxifou](https://forum.inductiveautomation.com/u/souxifou)\
**Post date:** [May 13, 2019, 2:15pm UTC](https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940/4 "2019-05-13T14:15:41Z")

</div>

> [@cmallonee](#):
>
> Whatever you are clicking in the Templatemission View could broadcast a message with `system.perspective.sendMessage()` at the page or session level, and then your Flex Repeater would then need a listener configured (right-click the FlexRepeater, then select “Configure Scripts” and create a new listener where you provide a message type key which matches the one configured in the Templatemission View).

Can you explain me how system.perspective.sendMessage() works ?  
I never used it before

Thanks

---

<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:** [May 13, 2019, 2:18pm UTC](https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940/5 "2019-05-13T14:18:24Z")

</div>

Depending on where you’re accessing it from, it would be something like

```auto
self.view.rootContainer.getChild('FlexRepeater').props.instances[x].param_name

```

`.getChild('FlexRepeater').custom` would be referencing a custom property on the Flex Repeater, not one of the internal instances.

I don’t think `self.parent.parent.getSibling('root')` should work, as a “root” will never have a sibling. A View’s structure MUST always be View(1) -\> root(1) -\> Components/Containers(0 - some number we haven’t determined yet)

---

<div class="post-metadata">

**Author:** ![souxifou](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@souxifou](https://forum.inductiveautomation.com/u/souxifou)\
**Post date:** [May 14, 2019, 6:27am UTC](https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940/6 "2019-05-14T06:27:41Z")

</div>

> [@cmallonee](#):
>
> Depending on where you’re accessing it from, it would be something like

I'd like to access from my TemplateMission view  
So is it possible to access one of flexrepeater custom from TemplateMission ?

---

<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:** [May 14, 2019, 2:17pm UTC](https://forum.inductiveautomation.com/t/perspective-flexrepeater-custom/24940/7 "2019-05-14T14:17:06Z")

</div>

Ah, okay, so you’re trying to reference a property on your FlexRepeater from WITHIN one of the internal instances?

Short answer: no, you can’t - templates (Views in Embedded Views or Flex Repeaters) don’t know about the structure of their parent

Long Answer: Yes, of course, but you need to bind FlexRepeater.props.instances.input\_param\_name to the property on the Flex Repeater. This will allow the Template Mission View to be supplied with a value from the Flex Repeater. The problem you will run into is if you’re trying to write BACK to the Flex Repeater value, as if MULTIPLE instances are bound to the variable then how do you know which instance wrote to it?

What I would recommend is pass each instance of Template Mission a param (“instance\_number”) which is its instance number. Whatever trigger you would use to fire the onClick Event should use

```auto
system.perspective.sendmessage(
    messageType='TEMPLATEMISSIONCLICK',
    payload={'instance_number':self.view.params.instance_number},
    scope="page")

```

Your Flex Repeater should have a custom property named “instance\_number”, and a configured listener which is listening for the “TEMPLATEMISSIONCLICK” message type at the Page scope, with a script of `self.custom.instance_number = payload['instance_number']`

Using the posted method will allow you to see which of your instances was most recently clicked.
