Professional OPC
Development Tools


Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Unable to Write to Int Array tag unless I specify the value

20 Oct 2017 12:30 #5605 by cdunlap
Sure. I will send them in a separate email shortly. Thank you.

Please Log in or Create an account to join the conversation.

20 Oct 2017 07:52 #5602 by support
As opposed to OPC Classic, in OPC UA the value written must precisely match the data type on the server. This can of course get quite problematic. For that reason, QuickOPC attempts to determine the data type and make the appropriate conversion before writing. To my knowledge, other toolkits don't even do that.

Whether this works on not depends on the information provided by the server. We rely on the DataType and ValueRank attributes on the node. This mechanism has been in QuickOPC for quite long, but there have been improvements in 2017.1 (related to subtypes) and will be more in 2017.2 (related to ValueRank-s which do not specify the rank precisely).

So my guess is that the DataType/ValueRank on that node did not allow us to determine the type. But in such case we should still attempt the Write, with whatever values we have at hand (the variantType: Variant Array looks OK in this respect, but the value itself should not be empty). Can you send me configuration so that I can have a look at it? (Note: I will be out of office between October 22-31).


Please Log in or Create an account to join the conversation.

19 Oct 2017 20:55 #5599 by cdunlap

I am using build 5.50.323.1.

I am trying to write to an int array in my OPC Server and have found that I must specify the data type when creating the UAWriteValueArguments that get passed into the call to WriteMultipleValues.

I know the release notes for 2017.1 say that this should not be required, correct?

If I run the following code:
var opc = new EasyUAClient();
var value = new int[50];
var tag = "nsu=TOP Server;s=Channel1.Device1.Tag1";
var endpoint = "opc.tcp://";
value[0] = 2;
UAWriteValueArguments[] argArray = new UAWriteValueArguments[2];
argArray[0] = new UAWriteValueArguments(endpoint, tag, value, value.GetType());
argArray[1] = new UAWriteValueArguments(endpoint, tag, value);
var results = opc.WriteMultipleValues(argArray);

The results array comes back with index 1 succeeding, and index 2 failed with BadTypeMismatch status code.

The server I am using has built-in OPC UA Diagnostic utilities that let me view the WriteRequest that is being made, and it looks like the array of values is not even being passed in the WrieRequest:

Is there something I am doing wrong, or is it simply required to pass the data type when writing?

Thanks in advance for the help.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.047 seconds