AdvancedHMI Software

General Category => Support Questions => Topic started by: Phrog30 on July 15, 2016, 10:59:42 PM

Title: CLX/CpLX Array Size
Post by: Phrog30 on July 15, 2016, 10:59:42 PM
Is it possible to grab an array size, either "standard" DINT, or UDT?  I know I can get the size within the PLC and send it to the app if necessary, just wondering if there is a fancy way to cut out the middle man.  Basically, I am writing some value to the PLC and want to ensure I'm within the boundaries.

Thanks,
James
Title: Re: CLX/CpLX Array Size
Post by: Phrog30 on July 18, 2016, 08:17:29 PM
Bueller....
Title: Re: CLX/CpLX Array Size
Post by: dmroeder on July 18, 2016, 11:21:40 PM
There isn't a way to give the driver a tag name and get the array size in return.
Title: Re: CLX/CpLX Array Size
Post by: bachphi on July 19, 2016, 02:04:48 PM
And how do you get the size within the PLC?
Title: Re: CLX/CpLX Array Size
Post by: dmroeder on July 19, 2016, 02:25:47 PM
There is an instruction called SIZE that will return an array size
Title: Re: CLX/CpLX Array Size
Post by: Phrog30 on July 19, 2016, 07:54:12 PM
Thank you for the reply.
Title: Re: CLX/CpLX Array Size
Post by: bachphi on July 20, 2016, 07:50:00 AM
No WAY!

(https://s31.postimg.org/skig11p2j/SIZE.png)

Thanks.
Title: Re: CLX/CpLX Array Size
Post by: bachphi on July 20, 2016, 08:51:22 AM
I've developed it a little further, now not only we can find the size of array, but also how much is occupied in that array. The cmdSend is a string and contain 'HELLO'.  Using FSC instruction, you can find  that there are 5 letters occupied that array.

(https://s32.postimg.org/ltcgeev3p/Size_and_File_Search.png)
Title: Re: CLX/CpLX Array Size
Post by: dmroeder on July 20, 2016, 11:41:37 AM
If you want to know how many letters are in a string, just look a the .LEN property. cmdSend.LEN should = 5.
Title: Re: CLX/CpLX Array Size
Post by: bachphi on July 20, 2016, 12:45:14 PM
It's only a simple example to demonstrate the point. You can not really use LEN to find out in a case of UDT:  PalletData[STA_1_PAL].Fail_Code[FSC.POS]>0