# Read/Write and Clear from an Array Tag (integer array)

**URL:** <https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199>\
**Category:** General Discussion\
**Created:** [May 25, 2023, 10:56pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199 "2023-05-25T22:56:05Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [December 11, 2023, 2:28pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/21 "2023-12-11T14:28:20Z")

</div>

In the Tag Browser:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/2/724fe0d45a009a70e0f642e69596824050f16528.png)

For reference: [Tag Groups - Manual](https://docs.inductiveautomation.com/display/DOC81/Tag+Groups)

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 11, 2023, 3:45pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/22 "2023-12-11T15:45:23Z")

</div>

I have creatred New tag group (Named as New1) , select it's mode as direct , rate i s 1000 ms, and add this New1 tag group in TO\_LVF\_CIT\_N

![99](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/7492c47d011c17da1466f8863f58bf1423c027bd.jpeg)

 ![88](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/4/34197c30852bc2225952005fdd2233773aff4c89.jpeg)

Then when I run above script (read and write OPC Tag and changed 1st value 631.67 ) in script console and refresh tag browser for checking value is changed or not...But still value is not changed I get this values  
[625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0])

instead of this-\> [631.6699829101562, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]))

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [December 11, 2023, 3:51pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/23 "2023-12-11T15:51:08Z")

</div>

So at a minimum, that tag group will read at a pace of 1000ms. So every second it will get new values.

The thing to do, would be to write to the tag and then check it in the PLC direct and start there before moving to Ignition.

If you change the data in the tag browser directly, does the value change in the PLC to the new value?

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 11, 2023, 4:10pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/24 "2023-12-11T16:10:27Z")

</div>

Yes, I already use system.tag.writingBlocking for that here then after also apply sleep but after that not get updated values on tag broswer also refresh and check it

```auto
import time

opcTagPath = "[Sample_Tags]TO_LVF_CIT_N"
# Read the current values from the OPC tag
currentValues = system.tag.readBlocking([opcTagPath])[0].value
print(currentValues)

c1 = currentValues[0]
print("c1",c1)

c1 = 631.67
print("updated c1 : ",c1)

currentValues[0] = c1
print("changed value : ", currentValues)

o = system.tag.writeBlocking([opcTagPath], [currentValues])
print system.tag.writeBlocking([opcTagPath], [currentValues])

opcServer = "UAS@VLC210203"
itempath = "nsu=https://www.S/;s=TO_LVF_CIT.CIT"
system.opc.writeValue(opcServer, itempath, currentValues)

print system.opc.writeValue(opcServer, itempath, currentValues)
print("End")

system.opc.readValue(opcServer, itempath)
print system.opc.readValue(opcServer, itempath)

time.sleep(3)

print("Again read updated values")
currentValues1 = system.tag.readBlocking([opcTagPath])[0].value
print(currentValues1)

```

Get this output

```auto
>>> 
array(java.lang.Float, [625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0])
('c1', 625.3499755859375)
('updated c1 : ', 631.67)
('changed value : ', array(java.lang.Float, [631.6699829101562, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]))
[Good]
Good
Good
End
[[Ljava.lang.Double;@101d3e93, Good, Mon Dec 11 21:34:49 IST 2023 (1702310689339)]
[[Ljava.lang.Double;@3cbb5a09, Good, Mon Dec 11 21:34:49 IST 2023 (1702310689341)]
Again read updated values
array(java.lang.Float, [625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0])
>>>

```

Entries not updated in tag browser:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/e/7e6e389bc5a045dbe74b01bdda811f2d4db69918.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [December 11, 2023, 4:11pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/25 "2023-12-11T16:11:30Z")

</div>

If you change the value directly in the tag browser, not via scripting, and then check the PLC is the data getting to the PLC?

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 11, 2023, 4:16pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/26 "2023-12-11T16:16:44Z")

</div>

No , I get this error when I change value directly in tag browser then get array element type mismatch  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/9/49d269e8334b790556b6de5035e47e4619fed414.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [December 11, 2023, 4:19pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/27 "2023-12-11T16:19:44Z")

</div>

Ok. You will need to start there and fix that first. Check the path to the tag etc... and get it working first from the Tag Browser. Then start implementing it in scripting.

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 11, 2023, 4:26pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/28 "2023-12-11T16:26:27Z")

</div>

Ok sure  
Here when I connect my OPC then default values that is coming from OPC in TO\_LVF\_CIT tag that giving Eroor\_TypeConversion , So that I have created new OPC tag named as TO\_LVF\_CIT\_ **N** and select Float Array datatype (while creating this tag) so then I show entries of this TO\_LVF\_CIT\_ **N** tag showing properly 625.35, 625.35 and so on because it is no. of values in Float array.👇👇

 ![66](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/5/356fc65441656ae94e84b74bec6179c3697a13f9.jpeg)

so is there mismatch occures while i am creating here float array ?  
And in Ignition -\>Config-\>Tags-\>Sample\_Tags-\>TO\_LVF\_CIT\_N shows entries in this way, Here all value are not separated with any delimiter  
(like space).

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/0/8031eff4f61d5b1b9db2261167d964abbe7e2ae4.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 11, 2023, 4:28pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/29 "2023-12-11T16:28:39Z")

</div>

Are you sure your OPC server is even capable of this write operation? Are you getting any logged errors in that software? You may need to be working with support to qualify that remote server's behavior (using wireshark on an unencrypted connection).

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 11, 2023, 4:40pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/30 "2023-12-11T16:40:06Z")

</div>

Yes , it is capable to write , because I have checked with other tages also when I changed value of that tag via tag browser or when run perspective project and changed its value by entering new value in numeric entry field then it's work properly, See below image I checked for 2 to 3 tags for normal reading writing but its data type is only float /double not float array , I face this problem only in Float Array datatype

 ![222](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e60d69f7c2ace47a30666e5714b2ca0354619d7f.jpeg)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [December 11, 2023, 4:53pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/31 "2023-12-11T16:53:36Z")

</div>

It doesn't seem to like the float array though.  
I agree with @pturmel. Might be time for more directed support to get this working first.

---

<div class="post-metadata">

**Author:** ![Swathi\_G](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@Swathi\_G](https://forum.inductiveautomation.com/u/Swathi_G)\
**Post date:** [December 11, 2023, 4:57pm UTC](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199/32 "2023-12-11T16:57:03Z")

</div>

> [@pturmel](#):
>
> mote server's behavior

ok sure will check.Thank you @bschroeder @pturmel

[Previous page](https://forum.inductiveautomation.com/t/read-write-and-clear-from-an-array-tag-integer-array/74199.md?page=1)
