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.
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
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:
# 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))