So I am terrible with queries and was trying my go at it, but it’s not working. I know I am missing something relatively simple. I am using the runPrepUpdate with in a tag change script to capture certain data from tags at that particular instance and throw them into a table. My log is giving me an error but it is hard for me to follow. Here is my script that I am using to attempt this.
Thanks for any assistance.
query = "INSERT INTO 'Filler3_Data' (dmx, pre_weight, time_stamp, position, dose_weight, post_weight, fault_code) VALUES (?, ?, ?, ?, ?, ?, ?)"
dmx = system.tag.read("[.]DMX_Cell").value
pre_weight = system.tag.read("[.]../../../5310/P5310_Mes/Weight/5310_Mes_w").value
time_stamp = (system.tag.read("[.]../../../5320/P5320_EOC_FILLING/Year").value,system.tag.read("[.]../../../5320/P5320_EOC_FILLING/Month").value,system.tag.read("[.]../../../5320/P5320_EOC_FILLING/Day").value,system.tag.read("[.]../../../5320/P5320_EOC_FILLING/Hour").value,system.tag.read("[.]../../../5320/P5320_EOC_FILLING/Minute").value,system.tag.read("[.]../../../5320/P5320_EOC_FILLING/Second").value)
position = system.tag.read("[.]P5320_pos").value
dose_weight = system.tag.read("[.]../../../5340/P5340_Mes/Weight/Weight_dose").value
post_weight = system.tag.read("[.]../../../5340/P5340_Mes/Weight/5340_Mes_w").value
fault_code = system.tag.read("[.]Op_Fault_Number").value
dbName = 'Prismatic_Data'
values = (dmx, pre_weight, time_stamp, position, dose_weight, post_weight, fault_code)
if not initialChange:
system.db.runPrepUpdate(query, values, dbName, '',True, True)