[Question] session.props.device.barcode values

I am wanting to start fresh each time I do a barcode scan, but I am getting the last thing scanned, and then it changes when I scan again… I run the scan through a transform:
with the property binding session.props.device.barcode
if value is None or len(value) is 0:
return ‘Nothing Scanned…’
else:
‘’‘session.custom.badge.write = value.data.text
scanned = WhatWasScanned.props.text’’’
return value[-1].data.text

If I run without the transform I get a whole list of what has been scanned. {“data”:{“text”:”24037”}}, {“data”:{“text”:”57517”}}, … …

How do/Can I re-initialize the array? I have already tried session.props.device.barcode = ‘’ to no avail…

I have also tried (with no luck):
data = session.props.device.barcodes
system.dataset.clearDataset(data)

Please note that barcode data has seen a substantial overhaul since this answer was provided.

If you don’t need the barcode data kept, you could wipe the info with

self.session.props.device.barcodes = []

But again, this would wipe any previous scans.

The reason your second approach isn’t working is because you’re making a new object which has your data, in addition to the existing session.props.device.barcodes, and then you’re wiping/clearing the new object while the original is still safely in place.

Awesome. Now if I could just get the morning beta download to move a little quicker… (30+ mins in so far…)

1 Like