Hi All,
I’m having an issue writing the value returned by a runNamedQuery to a tag,
if I replace “value” or “value1” with an integer it writes to the tag no problem,
Hoping someone can see something obvious,
CurrentBatchID = system.tag.read("[default]BatchID 1/BatchID").value
PrevBatchID = system.tag.read("[default]BatchID 1/PreviousBatchID").value
if CurrentBatchID == PrevBatchID:
value = system.db.runNamedQuery(“Test”,“Subtract Parts Made”, {})
system.tag.write("[default]BatchID 1/New Tag",“value”)
else:
value1 = system.db.runNamedQuery(“Test”, “Select Parts Made”, {})
system.tag.write("[default]BatchID 1/New Tag.value",“value1”)
My named queries are as follows;
Select Parts Made - SELECT TOP 1 Parts_Made FROM Actual_Made ORDER BY t_stamp desc;
Subtract Parts Made - SELECT T2.Parts_Made - T1.Parts_Made AS Parts_Made, T1.t_stamp AS t_stamp
FROM Actual_Made T1
JOIN Actual_Made T2 ON T1.[t_stamp] < T2.[t_stamp ]
ORDER BY [t_stamp] desc;
Each work correctly when tested,
Any tips would be appreciated,
Thanks