Page 1 of 1

Fixed-length string?

Posted: 05 Dec 2016, 22:28
by brtrodney
Is there any way to specify a fixed-length string variable, say a Version variable that is always 16 characters long? Is this even possible in OPC UA?

Also, I believe String variables are always Unicode? Or is there a way to specify ASCII? For example, what if I want to represent a variable that is 12 hexadecimal characters as a string of 12 ASCII characters?

Thanks in advance for any answers!

Re: Fixed-length string?

Posted: 13 Dec 2016, 10:06
by Support Team
ou can add the Property MaxStringLength (BrowseName 0:MaxStringLength, DataType UInt32) to a Variable with a string DataType.
Specification, Part 3: Only used for DataVariables having a String DataType.
This optional Property indicates the maximum number of characters supported by the DataVariable.

Note: You have to check the string length in the application. There is not toolkit support for evaluating this property.

Strings are encoded a UTF8 strings.

Re: Fixed-length string?

Posted: 20 Aug 2019, 14:21
by rsellars
I'm just getting started using your SDK and have requirements for using string variables. I would like to use the MaxStringLength property to limit the length of the string but I don't know where or how to add the property. Could you go into a little more detail.