runScript in tag expression fails

I have a tag expression containing runScript which is failing. When I look in tag diagnostics I get the error:

Error executing script for runScript() expression:shared.dars.batch.getInstanceCount(215,2).

However, if I run shared.dars.batch.getInstanceCount(215,2) from the script console, it returns a value.

Any ideas?

There are many scripting features that are different in gateway scopes compared to client or designer scope. Especially in gateway global scope (versus gateway project scope). You don’t show the actual getInstanceCount() function, so we can’t help you find the problem. But look up all uses of system.* functions in the manual to see the differences in usage.

The only system.* functions in use are system.tag.browseTags and This was working on my 7.9.9 machine but does not work on my 7.9.10 machine.


def getInstanceCount(entryId, unitId):

instanceCount = 0
# get the tagpath for the startId
recipeFolder = getRecipeFolder(unitId)   # does a based upon unitId
tagFilter="*/" + str(entryId) + "_*"
tagList = system.tag.browseTags(parentPath=recipeFolder, tagPath=tagFilter, recursive=False)
for tag in tagList:
	fullPath = tag.fullPath
	tagPath = fullPath + "/eventCount"
	instanceCount =

return instanceCount

I’ts usually a good idea to fully qualify your function when you run them in the gateway scope. getRecipeFolder() may not make it into the scope of getInstance, otherwise.

I suspect the difference is that your tag references, wherever they are, are relying on the project’s default tag provider. In gateway global scope, this must be included in all relevant string arguments. Gateway global scope is outside of any project, so there’s no “default” to fall back on.


You are correct. The function getRecipeFolder(unitId) apparently worked previously because the tag it was reading was in the default tag provider. When I reinstalled on 7.9.10, I moved those tags to a new tag provider. Thank you!