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!
Fixed-length string?
Moderator: uamodeler
- Support Team
- Hero Member
- Posts: 3068
- Joined: 18 Mar 2011, 15:09
Re: Fixed-length string?
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.
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.
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 1
- Joined: 14 Aug 2019, 20:40
Re: Fixed-length string?
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.