# Dataset Expression Tag - Not populating

**URL:** <https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [January 18, 2019, 2:48pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970 "2019-01-18T14:48:53Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [January 18, 2019, 2:48pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/1 "2019-01-18T14:48:53Z")

</div>

I’ve created an expression dataset tag to hold2 columns of data. I would like to populate this tag with the runscript expression.

When i try to use runscript in the dataset tag expression window the tag shows a red X as if there is an error somewhere.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/4d0213566db4da49c2b96d03573e0b8a2481f566.png)

The script runs and returns the data just fine in a script consol window and when called via expression for the dataset to a repeater.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/05e485daf9b4e6c7d91203b85c8c4ef6e7396008.png)

I’m not sure why I can’t get this to properly return the dataset in question.

---

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [January 18, 2019, 2:49pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/2 "2019-01-18T14:49:30Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7566f6cfe3b8d53b165a6fb160efdf62124c601b.png)

---

<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 18, 2019, 2:58pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/3 "2019-01-18T14:58:47Z")

</div>

Tags are not in a project, so cannot call any project resources. Only scripts in the shared.\* namespace are usable. Also, you _really_ need to get your code out of the legacy app.\* namespace – it’s going away eventually, and its scoping rules create numerous headaches.

---

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [January 18, 2019, 3:25pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/4 "2019-01-18T15:25:41Z")

</div>

This script is located in the global shared script library, not part of the project. All of my scripts reside here, is that not where they should be?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e3e03aea9a7beeab525876f02a0ca8b3b8ffa76a.png)

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [January 18, 2019, 5:40pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/5 "2019-01-18T17:40:12Z")

</div>

Can you post your getTankDataset code?

---

<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 18, 2019, 6:00pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/7 "2019-01-18T18:00:42Z")

</div>

> [@andytimc](#):
>
> This script is located in the global shared script library, not part of the project.

Ok, missed that the first time.

Meanwhile, please add triple-backquotes on a line above your code, and again below your code, so the rest of us can read it... ( Use these: ``` )

---

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [January 18, 2019, 6:19pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/9 "2019-01-18T18:19:01Z")

</div>

```auto
# Function used to return a dataset of tanks for a specific pad
# Used to populate the tank template repeater on the pad data page
# Takes an tagpath argument of PadRootFolder
def getTankDataset(PadRootFolder):		
	import system
	path = PadRootFolder+"/Pad"
	 
	 # Create the rows for the dataset
	rows = []
	tags = system.tag.browseTags(parentPath = path, tagPath = '*tank*_name', sort = "ASC")
	row_count = 0
		
	for tag in tags:
		tag1 = system.tag.read(tag.path)
		
		if tag1.quality.isGood():
			tagName = tag.name
			endChar = tagName.rfind("_name")
			tagNum = tagName[4:endChar]
			row_count += 1
			newrow = [PadRootFolder, int(tagNum)]
			rows.append(newrow)
	
	#Create the dataset to send back
	headers = ["PadRootFolder","TankNumber"]
	dataSet = system.dataset.toDataSet(headers,rows)
	return system.dataset.sort(dataSet, "TankNumber", 1)

```

---

<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 18, 2019, 7:43pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/10 "2019-01-18T19:43:01Z")

</div>

Try including a provider in your PadRootFolder.

---

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [January 18, 2019, 7:58pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/11 "2019-01-18T19:58:59Z")

</div>

Thanks Phil, I just attempted that but it still won’t execute the call. If i have to I can make the tags memory tags and write the dataset to them via script. But i feel like I shouldn’t need to do that.

---

<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 18, 2019, 9:45pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/12 "2019-01-18T21:45:46Z")

</div>

Look in your gateway logs for errors related to this tag. There should be something.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [January 18, 2019, 10:24pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/13 "2019-01-18T22:24:26Z")

</div>

I mocked up your code on my system and it works fine. Did you save global after creating the shared script?

---

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [January 21, 2019, 1:06pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/14 "2019-01-21T13:06:05Z")

</div>

Thanks for all the responses guys. I have been trying to get anything to show up in the gateway log and I’ve been unsuccessful.

Also, I have saved globally after creating that script. I do have other scripts in the same script library which I have been able to call in an expression tag without any problems. I’m still at a loss as to why this won’t work for me on my end.

---

<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 21, 2019, 2:25pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-tag-not-populating/21970/15 "2019-01-21T14:25:48Z")

</div>

Consider adding logging to your script module to locate exactly where it is failing. Include a log call at the global level at the end of the script module so you can confirm that it is fully loaded without top-level errors.
