QR Code Scanner scans double value

Goal: Scan a code qr code that has a schema 24-######

Issue: sometimes the scanned result looks like a doubled value: ["24-000001","24-000001"]

Solution: I was going to try a bunch of ideas like validate it to schema. Or introduce a debounce or something. Unless there is a better way.

Question: Any best practice advice I can adhere to solving this?

It seems like the scanner components keeps a history of scans. I'm using an event handler on my scanner component to set the value of an input to {{_.last(self.data)}}, where self is the scanner component.

I also clear the value for the scanner component every time the user is expected to scan a new value.

Here's my full capture event handler:

Interesting approach.

However if I set the event handler to the scanner component I can't select this scanner as a component for this event handler. How did you manage to assign the component to it's own event handler?

:wave: @Scottsky I also don't see a way to select the self component from the component dropdown :thinking: I also don't see a setValue api for the scanner. I believe @adam_grid's example is setting a separate input component to the value of the last item in the scanner's history (self.data).

Do you think the scanner is scanning the same barcode multiple times? This setting might help:
image

We are also tracking feature requests to allow programmatic access to filter specific symbologies so you can reject unexpected scans.

1 Like