AdvancedHMI Software

General Category => Support Questions => Topic started by: bachphi on January 14, 2021, 05:26:42 PM

Title: Second BasicLabel is not read/function?
Post by: bachphi on January 14, 2021, 05:26:42 PM
I have two basic labels. The first label display data (more than what it actually has) but not the second label, not sure why??
As you see in the first pic, Print_TxtArray[0] has a length=6 and Print_TxtArray[2] has length=25
Code: [Select]
BasicLabel1.PLCAddressValue = Print_TxtArray[0]
BasicLabel2.PLCAddressValue = Print_TxtArray[2]      '[1] is too long

(https://i.postimg.cc/MHgNzy3D/Print-Txt-Array.png)


(https://i.postimg.cc/zBy15XXq/Basic-Label-Str462.png)

The textbox grab the lengthy data from BasicLabel1.
Title: Re: Second BasicLabel is not read/function?
Post by: Godra on January 14, 2021, 08:06:44 PM
Archie posted a patch for your issue:

   https://www.advancedhmi.com/forum/index.php?topic=2840.msg16916#new

You seem to be trying to read in custom length string.
Title: Re: Second BasicLabel is not read/function?
Post by: Godra on January 14, 2021, 09:16:24 PM
The patch is probably to resolve your issue of 2nd label not reading but is still not showing the string as readable text.

You can always do some additional testing with the following:

- Modiified BasicLabel that can read custom strings:

   https://www.advancedhmi.com/forum/index.php?topic=2619.msg15725#msg15725

- Reply #6 has the app that can read custom strings as well:

   https://www.advancedhmi.com/forum/index.php?topic=2563.msg16237#msg16237

Just by looking at your strings, if something doesn't show properly then you might need to change encoding in the code of the modified BasicLabel and/or the app I mentioned.
Title: Re: Second BasicLabel is not read/function?
Post by: bachphi on January 15, 2021, 08:20:03 PM
There seemed to be a simpler way to read Any custom string without too much complicating extraction:

Code: [Select]
    Public Class UDTStringCustom
        Dim s1 As String
    End Class

....
Dim MyUDT As UDTStringCustom = PLC.ReadUDT(Of UDTStringCustom)("LastBatch")
Title: Re: Second BasicLabel is not read/function?
Post by: Godra on January 16, 2021, 12:52:22 AM
That's a manual way of getting the value.

If you think that you could possibly make it a part of the BasicLabel to automate the reads, that would be nice.
Title: Re: Second BasicLabel is not read/function?
Post by: bachphi on January 16, 2021, 08:14:25 AM
Since there already is a
Code: [Select]
PLC.WriteCustomString() function, one can expect and hope that Archie is soon to have
Code: [Select]
PLC.ReadCustomString() to complete the set.  ;)