Using system.gui.conirm

Good afternoon all,

I am wanting to use the system.gui.confirm on a performed action. I cannot get it to work, says that I am missing attribute gui.

Please help.

def runAction(self, event):
	"""
	This event is fired when the 'action' of the component occurs.

	Arguments:
		self: A reference to the component that is invoking this function.
		event: An empty event object.
	"""
	data = self.getSibling("DateTimePicker").props.formattedValue
	category = "HMI"
	source = "ASCADA Client"
	usr = self.session.props.auth.user.id
	message = str(usr) + " Changed END OF SHIFT to " + str(data)
	data9 = usr 
	
	if system.gui.confirm("Are you sure you want to shutdown the plant?",
	"Really Shutdown?"):
		system.db.runNamedQuery("Tables/Change_Shift_Date",{
			"data": data
				})
				
			#Update Syslog		
	system.db.runNamedQuery("Tables/syslog_update",{
			"category": category,
			"source": source,
			"message": message,
			"data9": data9
				})
[details="Summary"]
This text will be hidden
[/details]

system.gui functions are Vision only.

1 Like

Is there an alternative or is it easier to just code it?

There’s no direct analogue. You’ll have to move to some kind of asynchronous replacement approach. For instance, open a popup view. Pass a message handler name or payload into the popup.
In the popup, if the user confirms, broadcast a message.
Then in the message handler, invoke your named query (in this case).
There’s no support for a generic “invoke this callback” function approach (yet), unfortunately.

This is an area where we plan to make some improvements, but no timeline.

1 Like