Good morning Team,
I have a table that holds a value that allows a user to disable/enable a crane. The table updates and writes to the PLC. I am unable to change how this is setup so I am looking for the best way to do create a switch for the users.
Here is the query for the table.
SELECT
Clemens.storage.data
FROM
Clemens.storage
WHERE
Clemens.storage.attribute = 'Crane2_Putaway_Enable'
Currently I am using a toggle switch. This was working from what I understand but recently it is "acting up". Meaning that if I enable/disable the crane it does not always "update" the table with the desired action. Sometimes, when they enable/disable it looks like it works then when they leave the screen and come back it has reverted back to the original state before they clicked the toggle swith.
Can anyone suggest a better option or maybe a reason why they are seeing a delay or it not working?
Here is the code that I use when the toggle is clicked:
UPDATE storage
SET data = :data
WHERE attribute = 'Crane2_Putaway_Enable'
def runAction(self, event):
# implement your handler here
data = self.props.label.text
category = "HMI"
source = "ASCADA Client"
usr = self.session.props.auth.user.id
message = str(usr) + " Changed Crane 2 Putaway to " + str(data)
data9 = usr
# Update Crane Putaway mode.
system.db.runNamedQuery("CFG Queries/crane2_putaway_mode",{
"data": data
})
#Update Syslog
system.db.runNamedQuery("Tables/syslog_update",{
"category": category,
"source": source,
"message": message,
"data9": data9
})