Flex Repeater - How can I get the instance number to use in a binding within that instance?

Hi, I have a flexible row I've built using a flex repeater, where the label uses a Descrition parameter per instance for the text label and a TagPath parameter for the root tag (of a UDT). On other uses of this I just type the label in, but I'm making a more dynamic page for some tags which have already have a description as a subtag in the UDT and I'ld like to be able tyo dynamically bind that instances tagpath into the tag reference for the description without needing to engineer another shape.
image
I can bind this by using for example:

{this.props.instances[0].TagPath}

However I have to manually enter the instance id, this of course would break if I inserted another instance in the middle etc. Is there any way to get the id of the instance programatically to use in a binding without doing it manually? {this} gives me the FlexRepeater not the instance within the repeater.

I hope this make sense! Any tips?

This was my reason for pushing for this feature:

Voted! a thisInstance or something similar would be really handy!

It looks like your instances are not dynamically generated, so why use a flex repeater ?
It seems to me it would be easier to just use embedded views.

If you have a lot of instances and a flex repeater made it easier because each instance parameters follow a pattern, you could generate all your instances at once with a script transform in a binding on the instances property, where you'd be able to get an id/index for each of them quite easily (with enumerate for example).

Broadly speaking, if there's no binding on the instances property, I believe there's an easier way to do things.

1 Like

It seems to me that you are trying to do something in the data for the flex repeater that properly should be done by the flex repeater's view. That gets the tagpath and can extend from it without having this problem.

2 Likes

@Craig_Rathbone, @nminchin, see my answer to Perspective Text Field Numeric Keypad - #41 by Transistor.
There is a secret "index" parameter passed to each instance of the flex repeater and you can use this for a variety of purposes.

2 Likes

Documentation is literally the opposite of "secret". :rofl:

2 Likes

OK, it's hidden in plain sight!

1 Like