Database failover update query

I cant get this query to work. I’m not sure why it doesn’t recognize this tag value. I assume I wrote the tag read incorrectly.

if system.tag.read("[System]Gateway/Database/JMCProcess/Available")==0:
qV1 = event.source.parent.getComponent(‘Popup Calendar’).date

system.db.runPrepUpdate("INSERT INTO PM_Fat_Ratio_XRay (time_stamp) VALUES (?)",[qV1], 'JMCProcess')

elif system.tag.read("[System]Gateway/Database/JMCProcess/Available")==1:
qV1 = event.source.parent.getComponent(‘Popup Calendar’).date

system.db.runPrepUpdate("INSERT INTO PM_Fat_Ratio_XRay (time_stamp) VALUES (?)",[qV1], 'FATRATIO')


[quote=“DWeber”]I cant get this query to work. I’m not sure why it doesn’t recognize this tag value. I assume I wrote the tag read incorrectly.[code]if system.tag.read("[System]Gateway/Database/JMCProcess/Available").value==0:
qV1 = event.source.parent.getComponent(‘Popup Calendar’).date
system.db.runPrepUpdate(“INSERT INTO PM_Fat_Ratio_XRay (time_stamp) VALUES (?)”,[qV1], ‘JMCProcess’)

elif system.tag.read("[System]Gateway/Database/JMCProcess/Available").value==1:
qV1 = event.source.parent.getComponent(‘Popup Calendar’).date
system.db.runPrepUpdate(“INSERT INTO PM_Fat_Ratio_XRay (time_stamp) VALUES (?)”,[qV1], ‘FATRATIO’)[/code][/quote]Yes, you left out the value references. I added them in the code above, along with [code ] and [/code ].
system.tag.read() returns a Qualified Value object, which contains the requested tag value in it’s value property.