Page 1 of 1

Input string was not in correct format while writing array

Posted: 03 Dec 2017, 18:48
by alipala
]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

Re: Input string was not in correct format while writing ar

Posted: 02 Jan 2018, 14:52
by Support Team
Hi alipala

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
    }
}