Scan Barcode how to show data in the label (onBarcodeDataReceived)

Hello.

I’m trying to send information for a Label using the Scan Barcode (with def onBarcodeDataReceived(session, data, context) ).
I can pass information using Tag (system.tag.writeAsync(‘Writable/scantest’, vCamSerial)) but I would like to pass directly to the Label.

Button trigger onClick → Scan Barcode

Session Event:
def onBarcodeDataReceived(session, data, context)
	SCRIPT.canCam([data.text])

Project Library:

def scanCam(vCamSerial):

#works but I don't want to use TAG
 system.tag.writeAsync('Writable/scantest', vCamSerial) 

#not works
 self.getSibling("Label_0").props.text = vCamSerial 

Thanks

The event is in the session, so it doesn’t have direct access to pages and views. Send a message at session scope. Have a handler on the label listening for session scope.

Is there some way to read a barcode (mobile onBarcodeDataReceived) to send the value without using TAG.

Yes, send a message to the label with system.perspective.sendMessage.

1 Like

Thanks, I will take a look at this method, I didn’t use sendMessage yet.