[Retool mobile] How to reset scanner value using JavaScript?

When I re-open a screen, I want the scanner component's (for QR code) value to be reset. Currently, what happens is that it keeps collecting the scanned QR codes in scanner1.data array, until the app is refreshed.

I want to find a way to do something like;

scanner1.resetValue()

I believe you're looking for scanner1.clearValue(), I can't remember if that one returns a promise. you could always console.log(typeof scanner1.resetValue()) just don't forget checking return types this way WILL result in the function actually running and resetting the value... one of the most annoying bugs possible is from when you "know" data is there but it isn't (linker errors still take the cake by a mile for odds of causing headaches imo :sob:)

image
Retool Docs

1 Like