# writeBlocking only write last tag of array

**URL:** <https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899>\
**Category:** Ignition\
**Created:** [February 4, 2020, 10:20am UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899 "2020-02-04T10:20:49Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mori.luca](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mori.luca/32/13424_2.png) [@mori.luca](https://forum.inductiveautomation.com/u/mori.luca)\
**Post date:** [February 4, 2020, 10:20am UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/1 "2020-02-04T10:20:49Z")

</div>

ret = system.tag.writeBlocking([

```
	FolderPath+"SO",
	FolderPath+"OpenType",
	FolderPath+"Product",
	#FolderPath+"WidthLL",
	#FolderPath+"HeightHH",
	#FolderPath+"FireClass",
	#FolderPath+"MaterialFinishing",
	#FolderPath+"RivetsNumber",
	#FolderPath+"DestinationRoller",
	#FolderPath+"PanelCounter",
],
[
	
	r["SO"],
	r["OpenType"],
	r["Product"],
	#r["WidthLL"],
	#r["HeightHH"],
	#r["FireClass"],
	#r["MaterialFinishing"],
	#r["RivetsNumber"],
	#r["DestinationRoller"],
	#r["PanelCounter"],
])

```

PLC is siemens 1500, whit opcua server enabled.

 ![53](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e83272451e6b1a1d3dff79406be604e31687e1e8.png)

When i use the WriteBlock it give me Good for all the entry of the array, but it actually write only the last one.  
Am I missing something?  
Thanks for your time.

```auto

Full Script ------------
def Go(PO, PanelSide, PanelID, FolderPath):
	
	#converto il valore utilizzato dal PLC
	PanelSide = "DX" if PanelSide == 2 else "SX"
	
	r = GetData(PO, PanelSide, PanelID)
	r = system.dataset.toPyDataSet(r)
	
	if not r :
		print "nessuna riga trovata"
		exit()
	
	if r.getRowCount() > 1 :
		print "error numero righe"
		exit()
	
	
	#se non ci sono errori prendo la prima riga
	r = Conversions(r)
	r = r[0]
	
	#compongo la path per i dati
	FolderPath = FolderPath + "/Data/"

	ret = system.tag.writeBlocking([
		
		FolderPath+"SO",
		FolderPath+"OpenType",
		FolderPath+"Product",
		#FolderPath+"WidthLL",
		#FolderPath+"HeightHH",
		#FolderPath+"FireClass",
		#FolderPath+"MaterialFinishing",
		#FolderPath+"RivetsNumber",
		#FolderPath+"DestinationRoller",
		#FolderPath+"PanelCounter",
	],
	[
		
		r["SO"],
		r["OpenType"],
		r["Product"],
		#r["WidthLL"],
		#r["HeightHH"],
		#r["FireClass"],
		#r["MaterialFinishing"],
		#r["RivetsNumber"],
		#r["DestinationRoller"],
		#r["PanelCounter"],
	])
	
	print r["Product"]
	print r["SO"]
	print r["OpenType"]
	
#------------------------------------------------------------------------------

def GetData(PO, PanelSide, PanelID):

	p = {"PO":PO, "PanelSide":PanelSide,"PanelID":PanelID}
	r = system.db.runNamedQuery("NuovaMatricola",p)
	return r
	
#------------------------------------------------------------------------------

#conversioni dovute a dati scritti diversamente su PLC
def Conversions(r):
	
	openType = -1
	if r[0]["OpenType"] == "1C" : openType = 1
	if r[0]["OpenType"] == "2L" : openType = 2
	if r[0]["OpenType"] == "3R" : openType = 3
	r = system.dataset.setValue(r,0,"OpenType",openType)
	r = system.dataset.toPyDataSet(r)
	
	
	
	destinationRoller = -1
	if r[0]["DestinationRoller"] == "P20" : destinationRoller = 0
	if r[0]["DestinationRoller"] == "P50" : destinationRoller = 1
	r = system.dataset.setValue(r,0,"DestinationRoller",destinationRoller)
	print destinationRoller
	r = system.dataset.toPyDataSet(r)
	
	return r
	
#------------------------------------------------------------------------------

```

---

<div class="post-metadata">

**Author:** ![tordvd](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tordvd/32/11525_2.png) [@tordvd](https://forum.inductiveautomation.com/u/tordvd)\
**Post date:** [February 4, 2020, 10:41am UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/2 "2020-02-04T10:41:51Z")

</div>

It might not be the solution, but it looks like you have a decimal separator at the end of your arrays.

```auto
FolderPath+"SO",
	FolderPath+"OpenType",
	FolderPath+"Product", **<----- HERE**
	#FolderPath+"WidthLL",
	#FolderPath+"HeightHH",
	#FolderPath+"FireClass",
	#FolderPath+"MaterialFinishing",
	#FolderPath+"RivetsNumber",
	#FolderPath+"DestinationRoller",
	#FolderPath+"PanelCounter",
],

```

---

<div class="post-metadata">

**Author:** ![mori.luca](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mori.luca/32/13424_2.png) [@mori.luca](https://forum.inductiveautomation.com/u/mori.luca)\
**Post date:** [February 4, 2020, 10:57am UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/3 "2020-02-04T10:57:45Z")

</div>

Thanks, but is not the case, the saparator is not the issue.

---

<div class="post-metadata">

**Author:** ![tordvd](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tordvd/32/11525_2.png) [@tordvd](https://forum.inductiveautomation.com/u/tordvd)\
**Post date:** [February 4, 2020, 11:08am UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/4 "2020-02-04T11:08:53Z")

</div>

ok. Never tried to remotely write to a derived tag before… Are you sure this is even possible?

---

<div class="post-metadata">

**Author:** ![mori.luca](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mori.luca/32/13424_2.png) [@mori.luca](https://forum.inductiveautomation.com/u/mori.luca)\
**Post date:** [February 4, 2020, 11:37am UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/5 "2020-02-04T11:37:50Z")

</div>

print system.tag.write(FolderPath+“Product”,"")  
#print system.tag.write(FolderPath+“SO”,"")  
#print system.tag.write(FolderPath+“OpenType”,-1)  
#print system.tag.write(FolderPath+“WidthLL”,-1)  
#print system.tag.write(FolderPath+“HeightHH”,-1)  
#print system.tag.write(FolderPath+“FireClass”,"")  
#print system.tag.write(FolderPath+“MaterialFinishing”,"")  
#print system.tag.write(FolderPath+“RivetsNumber”,0)  
#print system.tag.write(FolderPath+“DestinationRoller”,-1)  
#print system.tag.write(FolderPath+“PanelCounter”,-1)

I tried this as well, by commenting and doing some test, it results that only the last one of the block is been written.

---

<div class="post-metadata">

**Author:** ![tordvd](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tordvd/32/11525_2.png) [@tordvd](https://forum.inductiveautomation.com/u/tordvd)\
**Post date:** [February 4, 2020, 11:41am UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/6 "2020-02-04T11:41:22Z")

</div>

the correct syntax would be: `system.tag.write([FolderPath+“Product”],[""])`  
Edit: never mind thats ignition 7.9 😛

---

<div class="post-metadata">

**Author:** ![mori.luca](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mori.luca/32/13424_2.png) [@mori.luca](https://forum.inductiveautomation.com/u/mori.luca)\
**Post date:** [February 4, 2020, 11:43am UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/7 "2020-02-04T11:43:42Z")

</div>

Thats not the case, the system.tag.write doesent want array but single tag.

---

<div class="post-metadata">

**Author:** ![mori.luca](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mori.luca/32/13424_2.png) [@mori.luca](https://forum.inductiveautomation.com/u/mori.luca)\
**Post date:** [February 4, 2020, 12:54pm UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/8 "2020-02-04T12:54:20Z")

</div>

Think i found what i need here :

> [@jsonSet workaround in script](http://forum.inductiveautomation.com/t/jsonset-workaround-in-script/27560):
>
> Hi, I have a lot of OPC tags, each OPC tags are “Documentation” type with UDT. Want to update some values of struct member of UDT for these OPC tags through buttons in a template pop out window. I could pass the UDT structure (json format data) to the pop out window template and use jsonGet function to parse the UDT data in the pop out window. I want to use the jsonSet function to set some struct member of UDT data in the popped window but it seems that the jsonSet function doesn’t work in t…

---

<div class="post-metadata">

**Author:** ![mori.luca](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mori.luca/32/13424_2.png) [@mori.luca](https://forum.inductiveautomation.com/u/mori.luca)\
**Post date:** [February 4, 2020, 12:55pm UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/9 "2020-02-04T12:55:06Z")

</div>

Thanks for your time

---

<div class="post-metadata">

**Author:** ![tordvd](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tordvd/32/11525_2.png) [@tordvd](https://forum.inductiveautomation.com/u/tordvd)\
**Post date:** [February 4, 2020, 12:56pm UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/10 "2020-02-04T12:56:54Z")

</div>

good luck 🙂

---

<div class="post-metadata">

**Author:** ![mori.luca](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mori.luca/32/13424_2.png) [@mori.luca](https://forum.inductiveautomation.com/u/mori.luca)\
**Post date:** [February 25, 2020, 2:27pm UTC](https://forum.inductiveautomation.com/t/writeblocking-only-write-last-tag-of-array/31899/11 "2020-02-25T14:27:43Z")

</div>

It never worked for me in the end.  
As I don’t have much Java experience, not at all tbh, I didn’t manage to convert back the data to a PyDocument.

In the end, I managed to create tag by tag, declaring their own opc-ua string paths, using UDTs parameters as always.
