# Flex Repeater: Incrementing Tag Values on Button Click

**URL:** <https://forum.inductiveautomation.com/t/flex-repeater-incrementing-tag-values-on-button-click/97798>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [October 25, 2024, 9:41pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-incrementing-tag-values-on-button-click/97798 "2024-10-25T21:41:18Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [October 25, 2024, 10:13pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-incrementing-tag-values-on-button-click/97798/4 "2024-10-25T22:13:12Z")

</div>

Sure,

Right now you are passing the repeated view the tag path and the tag's value(I assume) so you can display it.

Instead, create a custom property on the repeated view and indirectly bind to the tag using the tagPath parameter. Make sure the binding is bidirectional.

 ![indirectExample](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/0/103284962c140d63d208c1c9c1b15712bccb2139.png)

Bind your tag value display (label or whatnot) to the `view.custom.tagValue` property.

Then, the script on your increment button on the repeated view can be as simple as

```python
def runAction(self, event):
	self.view.custom.tagValue += 1

```

Because you are using a bidirectional binding on the `tagValue` property, whenever it receives a new value from something other than the tag, it will write the new value back to the tag automatically.

This also lets your simplify your "add row" script a bit:

```python
	# Get the Flex Repeater component
	repeater = self.getSibling("FlexRepeater")

	# Get the current list of rows (instances)
	current_rows = repeater.props.instances

	# Get the row number for the new row (after appending)
	row_number = len(current_rows) + 1 # Adding 1 because row_number is 1-based

	# Construct the dynamic tag path based on the row number
	tag_path = "[default]Flex Repeat test/Row {}/Total".format(row_number)
	print "Hello, Ignition!"
	
	# Debugging: Print the constructed tag path
	system.perspective.print("Tag Path: {}".format(tag_path))

	# Append the new row to the list
	current_rows.append({"tagPath": tag_path})

	# Set the updated list back to the Flex Repeater
	repeater.props.instances = list(current_rows)

	# Debugging: Print the updated rows
	system.perspective.print("After Adding: {}".format(current_rows))

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/flex-repeater-incrementing-tag-values-on-button-click/97798)._
