How to display or get the data from an integer array tag?

Hi All,

Hope you all doing good.

I just want to ask how can I display in the table of my tag integer array values?

I’m a newbie in Ignition so bear with me.

Thanks a lot!

I generally avoid array tags, but if you need to use one, this function may help.

def ArrayTag2Dataset(tagName):
	'''
		Create a dataset using the name of an array tag
		example: ArrayTag2Dataset('[Test]ArrayTag')
		returns:  tagName           | value  
		         ----------------------------
		          [Test]ArrayTag[0] | 1      
		          [Test]ArrayTag[1] | 2046   
		          [Test]ArrayTag[2] | 8675309
		          [Test]ArrayTag[3] | 42     
		          [Test]ArrayTag[4] | 73     
	'''
	values = system.tag.readBlocking([tagName])[0].value
	
	headers = ['tagName', 'value']
	data = []
	for i, value in enumerate(values):
		element = tagName + '[{}]'.format(i)
		data.append([element, value])
	return system.dataset.toDataSet(headers, data)

Hi JordanCClark,

Thank you very much.

-JR