Hi @matthew.ayre, thanks for the reply this is the below script which i have used.
if currentValue.value == 1:
# Run on every push
def CarTable(table, Rtable, row, Treatment, Len):
import system
oldtable = Rtable
CarData = system.tag.read("[.]…/CarData").value
for i in range(27):
Rtable = system.dataset.setValue(Rtable, i,0,(table.getValueAt(row,i)))
newCarFLG = 0
for m in range(oldtable.getRowCount()):
if Rtable.getValueAt(i,0) == oldtable.getValueAt(m,0):
Rtable = system.dataset.setValue(Rtable, i,1,(oldtable.getValueAt(m,1)))
newCarFLG = 1
if newCarFLG ==0:
Rtable = system.dataset.setValue(Rtable, i,1,0)
May be 1
Flag = 0
for j in range(table.getColumnCount()):
if table.getValueAt(row,j) > 0 and table.getValueAt(row,j) == Rtable.getValueAt(i,0) and Rtable.getValueAt(i, 1) <= Len:
Rtable = system.dataset.setValue(Rtable, i,1,(Rtable.getValueAt(i, 1) + 1))
Flag = 1
if Flag == 0 and (table.getValueAt(row,i) > 0 or Rtable.getValueAt(i, 1) > Len):
Rtable = system.dataset.setValue(Rtable, i,1,1)
elif Flag == 0:
Rtable = system.dataset.setValue(Rtable, i,1,0)
for k in range(CarData.getRowCount()):
if CarData.getValueAt(k,0) == Rtable.getValueAt(i,0):
if CarData.getValueAt(k,11) == 1:
cntr = CarData.getValueAt(k,12)
else:
cntr = CarData.getValueAt(k,13)
if CarData.getValueAt(k,10) in (0,1,2):
dbWt = CarData.getValueAt(k,1)
elif CarData.getValueAt(k,10) in (3,4):
dbWt = CarData.getValueAt(k,2)
else:
dbWt = CarData.getValueAt(k,3)
Rtable = system.dataset.setValue(Rtable, i, 2, int(CarData.getValueAt(k,4)))
Rtable = system.dataset.setValue(Rtable, i, 3, CarData.getValueAt(k,Treatment))
Rtable = system.dataset.setValue(Rtable, i, 4, int(CarData.getValueAt(k,5)* cntr))
Rtable = system.dataset.setValue(Rtable, i, 5, int(CarData.getValueAt(k,5)* cntr) * dbWt)
if i < 27 and Rtable.getValueAt(0,0) != oldtable.getValueAt(0,0) :
Rtable = system.dataset.setValue(Rtable, i+1, 6, oldtable.getValueAt(i,6))
return Rtable
t = system.tag.read("[.]../KilnDryerCars").value
#For Kiln 1
r = system.tag.read("[.]Kiln1CarData").value
K1 = CarTable(t, r, 1, 8, 104)
system.tag.write("[.]Kiln1CarData", K1)
#For Kiln 2
r = system.tag.read("[.]Kiln2CarData").value
K2= CarTable(t, r, 3, 9, 107)
system.tag.write("[.]Kiln2CarData", K2)
from time import sleep
sleep(5)
system.tag.write("[.]KilnTrigger", 2)
system.tag.write("[.]KilnRecord", 1)
Thanks,
Kartik