Fixed-length string?

Questions regarding the use of UaModeler

Moderator: uamodeler

Post Reply
brtrodney
Sr. Member
Sr. Member
Posts: 10
Joined: 23 Nov 2016, 23:32

Fixed-length string?

Post 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!

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

Re: Fixed-length string?

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

rsellars
Jr. Member
Jr. Member
Posts: 1
Joined: 14 Aug 2019, 20:40

Re: Fixed-length string?

Post 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.

Post Reply