# Table with tags and their values

**URL:** <https://forum.inductiveautomation.com/t/table-with-tags-and-their-values/21882>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [January 15, 2019, 5:56am UTC](https://forum.inductiveautomation.com/t/table-with-tags-and-their-values/21882 "2019-01-15T05:56:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![emovspunk1996](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@emovspunk1996](https://forum.inductiveautomation.com/u/emovspunk1996)\
**Post date:** [January 15, 2019, 5:56am UTC](https://forum.inductiveautomation.com/t/table-with-tags-and-their-values/21882/1 "2019-01-15T05:56:10Z")

</div>

I am creating a table where it displays the tags and their values. I used a timer to refresh the contents of the table. I cant figure out how to append the values of the two scripting functions which are the system.tag.browseTags and system.tag.readAll in a single dataset  
Thanks for the help

```auto
if event.source.value >= 1:
	path = []
	tagDataset = []
	blank = []
	tagHeaders = ['name', 'fullPath', 'type', 'dataType', 'value', 'quality']
	values = system.tag.readAll(path)
	browseTagArray = system.tag.browseTags(parentPath="folder/folder/test")
	
	for tag in system.tag.browseTags(parentPath="folder/folder/test"):
		path.append(tag.fullPath)
	
	for browseTag in browseTagArray and QualifiedValue in values:		
		tagDataset.append([browseTag.name, browseTag.fullPath, browseTag.type, browseTag.dataType, QualifiedValue.value, QualifiedValue.quality]);

	data = system.dataset.toDataSet(tagHeaders, tagDataset)
	table = event.source.parent.getComponent("Table")
	table.data = data

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 15, 2019, 1:45pm UTC](https://forum.inductiveautomation.com/t/table-with-tags-and-their-values/21882/2 "2019-01-15T13:45:22Z")

</div>

You have a couple mistakes and a missed opportunity:

- First, your call to system.tag.readAll() is occurring before you’ve constructed the list of paths. Move it to after your first for loop.
- Second, your 2nd for loop is not valid python/jython syntax. A for loop can only iterate over one list. You must combine your two lists into a list of pairs. The built-in zip() function will do this. Like so:

```auto
for browseTag, QualifiedValue in zip(browseTagArray, values):
    tagDataset.append(....)

```

- Finally, you are calling system.tag.browseTags() twice. Just use your browseTagArray in your first for loop.

---

<div class="post-metadata">

**Author:** ![emovspunk1996](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@emovspunk1996](https://forum.inductiveautomation.com/u/emovspunk1996)\
**Post date:** [January 16, 2019, 1:45am UTC](https://forum.inductiveautomation.com/t/table-with-tags-and-their-values/21882/3 "2019-01-16T01:45:51Z")

</div>

Thanks you so much! it works. I notice that the QualifiedValue.value only accept integer values. Is there a way to read the double and float values?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 16, 2019, 1:45pm UTC](https://forum.inductiveautomation.com/t/table-with-tags-and-their-values/21882/4 "2019-01-16T13:45:44Z")

</div>

> [@emovspunk1996](#):
>
> I notice that the QualifiedValue.value only accept integer values.

Not true. Each will have the datatype of the underlying tag. If that's not what you're seeing, you're doing something wrong.

---

<div class="post-metadata">

**Author:** ![emovspunk1996](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@emovspunk1996](https://forum.inductiveautomation.com/u/emovspunk1996)\
**Post date:** [January 17, 2019, 2:11am UTC](https://forum.inductiveautomation.com/t/table-with-tags-and-their-values/21882/5 "2019-01-17T02:11:24Z")

</div>

I tried to put a float and double datatype tag in the parentpath. And it gives an error of “Unable to convert row 3, column 5 to type class java.lang.Integer”. But if the tag is an integer and boolean dataType only there’s no error.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 17, 2019, 1:04pm UTC](https://forum.inductiveautomation.com/t/table-with-tags-and-their-values/21882/6 "2019-01-17T13:04:34Z")

</div>

Ah, your problem is in the system.dataset.toDataSet() utility. Datasets must have a single datatype for a column, and that function uses the first row to establish the types. You’ll need to go under the hood and use the [DatasetBuilder](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/common/util/DatasetBuilder.html), where you can explicitly specify your types. You’ll need java.lang.Object for your variant column.
