Error in writing to tags

There is a script written in message Handler under gateway events in designer and the message is to update in Tags of type data

set but it shows some error
How to debug the error
Message and error is attached

Looks like there is some kind of failure coercing a value at line 30 in your script, specifically [client]New Tag… Make sure that if you’re doing a write to a tag that you put the tag path and the value in a list (the function is intended to be able to write to multiple tags). So something like:

# Works, both arguments are Lists
system.tag.writeBlocking(['[client]New Tag'], [1234])
# Does not work, need to have list of tags and list of values
system.tag.writeBlocking('[client]New Tag', 1234)

Among other things, you can’t access client tags from the gateway…

2 Likes

Tag Path is correct
I tried by making arguments of tag path and data as List
but Tag is not updated
No error is found

Screenshot from 2021-01-22 10-22-57
Data is loaded into the logger
Is there any method to write to Tag through Message Handler in Gateway event scripting

So how can I store data in tags for further processing in Message Handler

You can’t. Pass everything you will need in the payload. If you need a return from the gateway message handler, you must use .sendRequest() instead of .sendMessage() and use the return value.

The key point is that client tags exist independently in each client–local to the client. The gateway has no access to any client’s local scope. Including the variables in jython and gui windows or components–they are independent in every client. Every bit of information that needs to pass from client to gateway or vice versa must use some form of messaging. Regular tags are the core tool for this, with specific data types. Messages are the generic tool, allowing any serializable data type.

1 Like