I am trying to create a dataset-expression type tag that uses an expression to create its dataset. I have created a script that will return a dataset but when I am binding the value of the tag to this script using the following expression:
I continually keep getting error_expressionEval. I have included the script in the global project based on previous forum discussions ( runScript in expression tag - Ignition - Inductive Automation Forum)
and also run the script on script console. It runs fine on script console where the end product is a dataset, but I can not figure out why the expression on the dataset keeps throwing the error_expressionEva error. Can someone please help me with this?
{ Please edit your comment, highlight all of the pasted code, then click the "preformatted text" button in the comment editor. This will make a proper code block for us, instead of the mismash currently shown. }
I don't see anything obviously wrong with your script but just check - running getRoleCredentials("Operator") in script console works or does it throw some error?
This is your problem. That hierarchy doesn't exist in gateway scope (nor Perspective scope). You should not expect an expression tag to be able to use any information specific to user interfaces.
When you catch errors in gateway scope, you should be logging the error details. Whether that is an appropriate return value is moot, as you are attempting to do something in gateway scope that is simply not possible. Gateway scope doesn't have client information.