# Flex Repeater, iterate through based on tag structure value

**URL:** <https://forum.inductiveautomation.com/t/flex-repeater-iterate-through-based-on-tag-structure-value/98752>\
**Category:** Ignition\
**Created:** [November 18, 2024, 7:13pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-iterate-through-based-on-tag-structure-value/98752 "2024-11-18T19:13:15Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [November 18, 2024, 8:46pm UTC](https://forum.inductiveautomation.com/t/flex-repeater-iterate-through-based-on-tag-structure-value/98752/4 "2024-11-18T20:46:41Z")

</div>

I would normally write a binding script on the `instances` param that scans the folder of pumps and for each pump with visibility enabled, I append another instance to a JSON array that becomes the return value that populates the `instance` parameter.

```python
def transform(self, value, quality, timestamp):
	totalPumpUdts = 10 #Total number of pumps to scan through
	
	tagPaths = []
	instances = []
	
	#Make a list of tag paths to read the pump visibility from
	for pump in range(totalPumpUdts):
		tagPaths.append("[default]PLC Tags/Pumps/Pump " + str(pump+1) + "/Visibility")
	tagResults = system.tag.readBlocking(tagPaths)
	
	#Build instance array
	for visiblePump in tagResults:
		if visiblePump.value:
			instances.append({
			    "instanceStyle": {
			    "classes": ""
			    	},
			    "instancePosition": {},
			    "udtPath": "[default]PLC Tags/Pumps/Pump " + str(visiblePump+1),
				})
	return instances

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/flex-repeater-iterate-through-based-on-tag-structure-value/98752)._
