
bonbon (Customer) asked a question.

bonbon (Customer) asked a question.
Hi @bonbon (Customer)
The following posts may help you out with arrays in productivity.
https://accautomation.ca/productivity-1000-series-plc-array-functions-part-1/
https://accautomation.ca/productivity-1000-series-plc-array-functions-part-2/
https://accautomation.ca/productivity-1000-series-plc-array-functions-part-3/
These are part of a complete series on the P1000.
https://accautomation.ca/series/productivity-1000-plc/
I hope this helps you out.
Regards,
Garry

Thank you Gary for the reply. I am looking for a way to be able to expand the array size as more data will be collected.

Array resizing is a DESIGN-TIME operation.
How much data do you need to buffer? Do you need easy access to the data? Can a FILI (FIFO/LIFO) instruction do the job?

I am using two columns array to store volume to its corresponding barcode. There will be time in future where I would like to add a new barcode or modifying existing data. Is there simpler way to work on this?

How many barcodes do you have/anticipate?
Is it one barcode per one volume value?
A big, mostly empty, array is not a significant inconvenience for the PxK.
One of my arrays is S32 -- 600 rows x 100 columns.
You can size it large enough, now, for your anticipated needs. If you eventually need more, you can resize the array at a later date. However, this array resizing will require a STOP-MODE transfer.
Do you need to make this array retentive? If so, be sure you are not attempting to make the array larger than the available RETENTIVE size. <-- this value can be found at the bottom of the tag database

Yup exactly one unique barcode for a volume. Eventually I am going to use HMI to be able to modify the array elements. Thank you, making the array big enough is a really simple solution to this

You're welcome!
You can use the array INDEX to point to the elements you need to modify!
That way you minimize how many HMI edit fields you need.
We can discuss that if you'd like.
Let us know if you have stumbling blocks or successes!

Hi could you please elaborate what do I need to be able to display an array on HMI and edit them. thank you

[edit 10/28 11:52 cropped the image. The PAC project is unrelated to HMI project]
Let's make a few assumptions.
.. the array is S32. I do not recall that you specified the datatype
.. the first column is BARCODE, the second column is VOLUME
.. editor will allow editing of 1 row in your existing array.
.. both columns will be available.
.. we need an array to hold the COPY of your data. Make this array AR2S32 1 row X 1 2 columns. Name this array EDITOR.
.. we need two boolean operation tags. Name one SAVE and one LOAD
.. we need one boolean state tag. Name this tag IsDirty
.. we need a numeric tag to use as an index. Name this tag EDITORptr
.. we do not want to destroy existing array data.
.. we want to load/reload/save data.
(You can rename as your naming protocol requires. I named them for ease of understanding)
Create the appropriate tags in the CMORE tagdatabase
Make two button objects on the HMI. Tag one with SAVE and the other with LOAD
.. Tag the SAVE button's visibility with IsDirty
.. The LOAD should not require a visibility tag since we want to reload at will
[edit 10/28 12:03 I usually use BUTTON SET in HMI and have PLC RESET when the event is handled. This provides a oneshot and a basic sort of handshake.]
Make two numeric entry objects.
Tag one with EDITOR(EDITORptr),(1) to represent a copy of your Barcode value
Tag the other with EDITOR(EDITORptr),(2) to represent a copy of your Volume value
In PLC,
when the LOAD bit is true (ensure that EDITORptr is a valid value within the range of your array) and copy (CPA) from your existing array to the EDITOR array using the EDITORptr tag as the StartRow and EndRow, put 1 in Start Col and 2 in End Col.
Reset the LOAD bit
when the SAVE bit is true reverse this operation.
Reset the SAVE bit.
When the HMI has the editor screen open, on some interval , compare the values of
EDITOR(1) with your existing array (EDITORptr),(1)
and
EDITOR(2) with your existing array (EDITORptr),(2)
If either is different, turn on the IsDirty bit which will enable the visibility of the SAVE button.
I hope that this is understandable enough. It may seem like overkill, but I have used a scheme like this for editing arrays with hundreds of rows/columns. I have used it to create/edit recipes and at one time, I used it to create a Proof of Concept of a recipe editor EDITOR! see attached image
If I have left out something, or if I have completely confused you, let me know.
happy editing.
[edit 10/28 12:52 resized editor column to 1 X 2, D'OH]

I dont think I understand how a 1x1 array could hold copy of my data. Do you mind to explain that part again and whether the array should be define in plc database or c more
Copyright © 1999-2023 AutomationDirect. ALL RIGHTS RESERVED
In my description, the 1 x
12 EDITOR array only holds ONE row of data to make it available to the EDITOR.After you get your head wrapped around my scheme, you can resize it to however many rows you require. You would, then, need more tags in the CMORE to handle increased array size.
You need the array in the PLC and tags that represent the array in CMORE.
If you need more rows available to edit, you can make the EDITOR array whatever row count you need., then you
wouldmight need to make your EDITORptr increment/decrement by that size.Also, if you make your EDITOR array larger, your LOAD/SAVE/IsDirty comparison range values would have to change.
One thing my first description left out was how to make the HMI EDITOR navigate through your existing array.
Let us know if this gets you on your way to happy editing.
Again, ask if you need more description.
[EDIT What software versions are you using, in case I have time to make a mockup for you?]
[edit 10/28 12:52 resized EDITOR array to 1X2 smh]