cancel
Showing results for 
Search instead for 
Did you mean: 

Tag Query

Former Member
0 Kudos

Hi,

When writing to a PLC Tag via UDS, how to determine if the write was successful. Not just based on the 'TagQuery.Success', but based on the existence of the tag. For instance, if I typed the name of a tag incorrectly ( or if the tag wasn't existing), is there a way I would know the write wasn't successful?

Regards,

Chanti.

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

A successful CurrentWrite query should echo the new values back to you in the query results, which should look the same as a Current mode query (a Rowset per tagname with DateTime / Value). There should also be messages in the resultset for those tags that were unsuccessful.

The Success bit will likely be true unless the whole query fails or you have a communication failure through the data server, so you will need to interpret the resultset from the query results.

Former Member
0 Kudos

Thanks. I realized that as well. I have observed the query returns a message 'Couldn't add tag to the list' in the event a tag doesn't exist. Can you give me the Xpath to extract this message? Like 'Rowsets\Rowset\Row\<Tagname>' for the tag value.

Regards,

Chanti.

Former Member
0 Kudos

What would be the Xpath expression for extracting the messages returned by Tag Query?

jcgood25
Active Contributor
0 Kudos

Did you generate the sample xml when the configure dialog asked you to ?

I would expect every tag in your query to be part of the response, either with confirmation or with error, so it should be normal MII format:

/Rowsets/FatalError --> only one and would also mean total failure, which should make the success bit false

/Rowsets/Rowset/Messages/Message --> could be multiple message nodes

/Rowsets/Rowset/Row/TagName --> would vary based upon with rowset and the actual xmlencoded tagname

Query results and Messages can coexist in the resultset, because a Message is non-fatal.

Former Member
0 Kudos

Actually, "/Rowsets/Messages/Message" worked. But I wasn't able to extract all the messages if more than one existed. Any clues?

jcgood25
Active Contributor
0 Kudos

Use a Repeater on that path and you'll get them all.

Former Member
0 Kudos

Solved. Thanks.

Answers (0)