Dataset Expression Tag - Not populating

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.

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.

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

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.

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?


Can you post your getTankDataset code?

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: ``` )

# 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 =
		if tag1.quality.isGood():
			tagName =
			endChar = tagName.rfind("_name")
			tagNum = tagName[4:endChar]
			row_count += 1
			newrow = [PadRootFolder, int(tagNum)]
	#Create the dataset to send back
	headers = ["PadRootFolder","TankNumber"]
	dataSet = system.dataset.toDataSet(headers,rows)
	return  system.dataset.sort(dataSet, "TankNumber", 1)
1 Like

Try including a provider in your PadRootFolder.

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.

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

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

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.

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.