AdvancedHMI Software

General Category => Support Questions => Topic started by: sds5150 on February 07, 2020, 04:45:12 PM

Title: Single Character strings
Post by: sds5150 on February 07, 2020, 04:45:12 PM
We have a PLC tag that is defined as a String1 which has a max character of 1

How do I write to this tag?
When I try to do a
Write(String.Format("Q3_Pan[0].Part.Type.Code", "x")

I get the following error
MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException: 'Unknown data type. Unable to create byte stream. 50345'


Thanks
Title: Re: Single Character strings
Post by: Godra on February 07, 2020, 06:49:48 PM
Your code is missing a bracket and seems to be incorrect format all together.

Have you tried Write("Q3_Pan[0].Part.Type.Code", "x")?

See also what response you will get if you try using:

WriteCustomString(ByVal tagName As String, ByVal value As String, definedStringLength As Integer)

which in your case would be:

WriteCustomString("Q3_Pan[0].Part.Type.Code", "x", 1)
Title: Re: Single Character strings
Post by: Godra on February 07, 2020, 08:08:54 PM
I just tested this and you have to use the WriteCustomString in the code.

As for the visual control, the attached modified version of the BasicLabel will allow you to read the String1 data type, as well as to write to it.
This will work for as long as you enable its InterpretValueAsCLXString property, set the correct length in the CustomCLXStringLength property and add your tag to both PLCAddressValue and PLCAddressKeypadCollection properties.
Title: Re: Single Character strings
Post by: sds5150 on February 11, 2020, 10:54:23 AM
That helped!
Thanks!