Input string was not in correct format while writing array

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
alipala
Jr. Member
Jr. Member
Posts: 4
Joined: 14 Nov 2017, 15:13

Input string was not in correct format while writing array

Post 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

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

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

Post 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
    }
}
Best regards
Unified Automation Support Team

Post Reply