Error when using 'system.perspective.openPopup'

In Perspective, I use this methodology of configuring my params from my main view and passing them into a global popup view to get a response back from the end user, which then is fed back into the main view via message handlers. I have a list of param templates that I use for standard popups. Things like "Please Wait". "Cancel Confirm", "Submit Data", "Scrap Unit", etc.

def BadInput(sLotName):
	sPrimaryMsg = 'Material Lot ' + str(sLotName) + ' Not Found, has already been Used or Scrapped.'
	sSecondaryMsg = ''
	oParams = {}
	oParams['oButtonBinding'] = {}
	oParams['oButtonBinding']['oButtonOne'] = {}
	oParams['oButtonBinding']['oButtonOne']['bClose'] = False
	oParams['oButtonBinding']['oButtonOne']['bDisplay'] = False
	oParams['oButtonBinding']['oButtonOne']['bEnabled'] = False
	oParams['oButtonBinding']['oButtonOne']['sText'] = ''
	oParams['oButtonBinding']['oButtonTwo'] = {}
	oParams['oButtonBinding']['oButtonTwo']['bClose'] = True
	oParams['oButtonBinding']['oButtonTwo']['bDisplay'] = True
	oParams['oButtonBinding']['oButtonTwo']['bEnabled'] = True
	oParams['oButtonBinding']['oButtonTwo']['sText'] = 'OK'
	oParams['oButtonBinding']['oButtonThree'] = {}
	oParams['oButtonBinding']['oButtonThree']['bClose'] = False
	oParams['oButtonBinding']['oButtonThree']['bDisplay'] = False
	oParams['oButtonBinding']['oButtonThree']['bEnabled'] = False
	oParams['oButtonBinding']['oButtonThree']['sText'] = ''
	oParams['oIconBinding'] = {}
	oParams['oIconBinding']['iIconNumber'] = 2
	oParams['oLoadingBinding'] = {}
	oParams['oLoadingBinding']['bIsLoading'] = False
	oParams['oLogicBinding'] = {}
	oParams['oLogicBinding']['iPopUpSelection'] = 0
	oParams['oLogicBinding']['sClearViewName'] = ''
	oParams['oLogicBinding']['sPopUpID'] = 'gen_popup'
	oParams['oLogicBinding']['diPopUpPayload'] = {}
	oParams['oMessageBinding'] = {}
	oParams['oMessageBinding']['oPrimaryMessage'] = {}
	oParams['oMessageBinding']['oPrimaryMessage']['bDisplay'] = True
	oParams['oMessageBinding']['oPrimaryMessage']['iSize'] = ''
	oParams['oMessageBinding']['oPrimaryMessage']['sColor'] = ''
	oParams['oMessageBinding']['oPrimaryMessage']['sText'] = sPrimaryMsg
	oParams['oMessageBinding']['oSecondaryMessage'] = {}
	oParams['oMessageBinding']['oSecondaryMessage']['bDisplay'] = False
	oParams['oMessageBinding']['oSecondaryMessage']['iSize'] = ''
	oParams['oMessageBinding']['oSecondaryMessage']['sColor'] = ''
	oParams['oMessageBinding']['oSecondaryMessage']['sText'] = sSecondaryMsg
	oParams['oTitleBinding'] = {}
	oParams['oTitleBinding']['sLabelColor'] = ''
	oParams['oTitleBinding']['sLabelMessage'] = 'Bad Material Input'
	oParams = {'oPopupBinding': oParams}
	return oParams

dParams = BadInput('ABC123')
system.perspective.openPopup(sPopID, sPopupPath, params = dParams, showCloseIcon = bCloseIcon, resizable = bResize, modal = True)

It works quite well, but I have gotten the following exception on the line that opens the popup 7 times in various different places in my Project within the last month (~3,000 popups opened):

ex_type = <type ''>
ex_value = Channel is not set.

The last time I noticed it happening, this warning occured in the gateway logs at the exact same time. Unsure if they are related as we often get a lot of these warnings and I typically ignore them.

Worth noting, the operator was using the Perspective app on an iPad.

Also, I checked the Memory and CPU usage at that time, nothing out of the ordinary.

Wondering if anybody has come across that ' is not set' Exception or the 'WebsocketChannel code=1005' Warning?

I don't think those are related to the popup itself. Those are just connectivity issues between browser or app and the gateway. Check if your mobile device is putting the app or browser to sleep while the operator isn't looking at it. "Battery Saver" functionality can do this.

1 Like