Displaying a list from a tag read

I have this python code that reads through a list of tags then returns the tag list back to me in this format TW1,Quad_A,B,C or D wherever the opnum is found at

	from itertools import product
	
	def get_iterator(op_strings):
	    quads = ['A', 'B', 'C', 'D']
	    return product(range(1, 66), quads, op_strings)
	shift = system.tag.readBlocking("[default]Twisters/Selected Shift From Assigner")[0].value
	path = '[default]Twisters/TW{}/Operator Assignments/Quad_{} '+str(shift)+' Shift Operator {}'
	paths = [path.format(*p) for p in get_iterator(['Name', 'BadgeNum'])]
	tag_qvals = system.tag.readBlocking(paths)
	opnum = self.props.text #'0008161371'
	
	# Filter and extract TW and Quad from matching paths
	matching_paths = [p for p, q in zip(paths, tag_qvals) if q.value == opnum]
	for matching_path in matching_paths:
	    parts = matching_path.split('/')
	    twister_number = parts[1][2:]  # Extract the number from 'TW1'
	    quad_part = parts[3].split()[0]  # Get the Quad part before the space
	    self.getSibling("TextArea_3").props.text = ('TW{}, {}'.format(twister_number, quad_part))

When I print the result in the console I get a row for each output, in this case it looks like this:
TW1, Quad_B
TW1, Quad_C
TW1, Quad_D

BUT when I try and have that same returned to a label or textarea it returns only the last output, TW1,Quad_D.

How do i have return all the outputs?

I think your user requirements could be improved. I can't make any sense of it!

The first text field takes the input and writes the [1:11] to the label ...

Are they both text fields? Why different fonts?
There is no [1:11] in your screengrabs.
"... to the label ...". What label?

Hit the edit icon below the post ...

1 Like

I wound up doing this, its works ok for me:

	from itertools import product
	
	def get_iterator(op_strings):
	    quads = ['A', 'B', 'C', 'D']
	    return product(range(1, 66), quads, op_strings)
	shift = system.tag.readBlocking("[default]Twisters/Selected Shift From Assigner")[0].value
	path = '[default]Twisters/TW{}/Operator Assignments/Quad_{} '+str(shift)+' Shift Operator {}'
	paths = [path.format(*p) for p in get_iterator(['Name', 'BadgeNum'])]
	tag_qvals = system.tag.readBlocking(paths)
	opnum = self.props.text #'0008161371'
	
	# Filter and extract TW and Quad from matching paths
	matching_paths = [p for p, q in zip(paths, tag_qvals) if q.value == opnum]
	# Concatenate the matching paths into a single string
	output_string = ", ".join([
	    'TW{} {}'.format(p.split('/')[1][2:], p.split('/')[3].split()[0])
	    for p in matching_paths
	])
	self.getSibling("TextArea_3").props.text = (output_string)

My guess is that you're doing something like that:

for element in list:
    some_var = some_part_of_element
return some_var

Am I close ?

That's a big list of values, I'd probably use a table to display that.