I have a process that requires me to be able to write between 1 to 15 new values to a database depending on what is happening. I was able to do this in a client, but I lost something when I tried to make it a gateway script and I can’t find the error in the wrapper.log to read what is happening. This is the script I was trying to use:
scanned=system.tag.getTagValue(“Packaging/10A/BagsScanned”)
values=[system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_0_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_1_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_2_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_3_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_4_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_5_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_6_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_7_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_8_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_9_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_10_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_11_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_12_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_13_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_14_”),system.tag.getTagValue(“Packaging/10A/Scale_10_a_Weight_array_15_”)]
time=newValue.timestamp
for j in range(scanned):
weight=values[0][j]
system.db.runPrepUpdate(“INSERT INTO Giveaway_10A (Bag_Weight, time_stamp) VALUES (?,?)”,[weight,time])
The formatting isn’t cooperating for me but the indentation in the for loop should be correct. I looked into doing this with block groups too but the rows I want to add aren’t guaranteed to change they could be the same value each time. Any ideas or questions?