![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
10/28/2021
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Hello,
I am trying to write a single value in an array of booleans. My code looks as follows:
WriteValueCollection nodesToWrite = new WriteValueCollection();
WriteValue writeVal = new WriteValue();
writeVal.NodeId = new NodeId(nodeID);
writeVal.AttributeId = Attributes.Value;
writeVal.Value = new DataValue(new Variant(true));
writeVal.IndexRange = "1";
nodesToWrite.Add(writeVal);
StatusCodeCollection results = null;
DiagnosticInfoCollection diagnosticInfos;
session.Write(null,
nodesToWrite,
out results,
out diagnosticInfos);
Unfortunately I get a BadWriteNotSupported as a reply. I've tried setting writeVal.Value.Value to the following:
Boolean[] toWrite = { true };
Variant[] toWrite2 = { new Variant(true) };
Boolean[,] toWrite3 = { { true } };
And unfortunately I get the same error. It's possible to write single values by using ua Expert, so I am sure that the server allows writing single values.
I have been able to subscribe to the properties and read them, but not write to them. Any help would be greatly appreciated!
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Servers may not support index writes for every variable (some servers front end other systems which do not support the feature).
A WriteFullArrayOnly bit has been added to the AccessLevel to allow Servers to indicate when writes are not supported:
https://reference.opcfoundatio.....art3/8.58/
For servers that do not support the bit, the BadWriteNotSupported code tells that client that index writes are not supported for the variable.
1 Guest(s)