]Hi support team,
I am working over trial license before purchasing the license. I have faced with a problem while trying to write array values as "Input string was not in correct format". Please see the screenshot i attached in the link below.
Error: https://pasteboard.co/GWwQV6m.png
Waiting for your reply,
Ali Pala
Input string was not in correct format while writing array
Moderator: uasdknet
-
- Jr. Member
- Posts: 4
- Joined: 14 Nov 2017, 15:13
- Support Team
- Hero Member
- Posts: 3064
- Joined: 18 Mar 2011, 15:09
Re: Input string was not in correct format while writing ar
Hi alipala
You can not write arrays with the sample client. Here is an example, how to write an array on the .net demoserver:
You can not write arrays with the sample client. Here is an example, how to write an array on the .net demoserver:
Code: Select all
List<WriteValue> nodesToWrite = new List<WriteValue>();
/* Set new values to write */
List<UInt32> newValues = new List<UInt32>(new UInt32[] { 0, 1, 2 });
Variant value = new Variant(newValues);
/* Add array to WriteValues */
nodesToWrite.Add(new WriteValue()
{
NodeId = new NodeId("Demo.Static.Arrays.UInt32", 2),
AttributeId = Attributes.Value,
Value = new DataValue() { WrappedValue = value },
IndexRange = "1:3"
});
List<StatusCode> res = Session.Write(nodesToWrite);
/* Check result */
foreach (StatusCode result in res)
{
if (result.IsBad())
{
//write failed
}
}
Best regards
Unified Automation Support Team
Unified Automation Support Team