Fill dropdown list with folder of tags

Indeed, I messed up my tests when I tried it.
I used browse, as browseTags doesn't appear in the manual for 8.1 - I imagine it's been deprecated ?

Then I mixed things up, boinked it a bit more, and finally talked out of my ***.

Probably good not to use the deprecated function if I can avoid it, but I'm having a hard time converting it.

# get all tags in the analog folder
tags2 = [system.tag.browse("[default]Analog_Sensors", {'typeId':'Scaled_Analog_2SP'}).results]
tags4 = [system.tag.browse("[default]Analog_Sensors", {'typeId':'Scaled_Analog_4SP'}).results]
	
tags = tags2 + tags4

I think the last line here doesn't work to add together these lists for some reason

That last line simply joins two single-element lists, yielding a list of lists.

I thought so as well, but I actually had to use this to get it to work:

# get all tags in the analog folder
tags2 = [system.tag.browse("[default]Analog_Sensors", {'typeId':'Scaled_Analog_2SP'}).results]
tags4 = [system.tag.browse("[default]Analog_Sensors", {'typeId':'Scaled_Analog_4SP'}).results]
	
tags = tags2[0] + tags4[0]

**edit: Doh :upside_down_face: it was my own brackets on the outside of the results making it a list of lists...

Interestingly, it also included a tag that is not the same UDT type in the list...

**edit: just now seeing this in the manual

final code:

# get all tags in the analog folder
	tags2 = system.tag.browse("[default]Analog_Sensors", {'typeId':'Scaled_Analog_2SP', 'tagType':'udtInstance'}).results
	tags4 = system.tag.browse("[default]Analog_Sensors", {'typeId':'Scaled_Analog_4SP', 'tagType':'udtInstance'}).results
	
	tags = tags2 + tags4
	
	# extract tag names and descriptions
	names = [str(t['name']) for t in tags]
	tag_paths = [str(t['fullPath']) + "/Parameters.Name_SA2SP" for t in tags]
	desc = [str(d.value) for d in system.tag.readBlocking(tag_paths)]
	
	# create dataset
	headers = ["Description", "Tag Name"]
	data = [[desc,name] for desc, name in zip(desc, names)]
	dataset = system.dataset.toDataSet(headers, data)
	
	print headers
	print data
	
	return dataset

results are exactly equal to what I had before