writeBlocking only write last tag of array

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.

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.


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
	
#------------------------------------------------------------------------------

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

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

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

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

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.

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

1 Like

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

1 Like

Think i found what i need here :

Thanks for your time

good luck :slight_smile:

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.