I’m building a Retool mobile app with a barcode scanner to make looking up products faster. I have a scanner1 component set up, and I want it to work like this:
After scanning a barcode, the app should navigate to itemDetailScreen and show the product whose id matches the scanned value.
The barcode values correspond to the id field in my productos table.
What I’ve tried so far:
I can get the scanned value using scanner1.data.
I thought of using a JS query or transformer to filter the product list and find the matching item.
But I’m not sure how to pass that selected item to itemDetailScreen, or how to set itemCollection.selectedItem correctly before navigating.
Has anyone done something similar? What’s the best way to:
Thanks for sharing such a thorough explanation, @WidleStudioLLP!
Adding on to the above, @max.lopezzz, you will likely need to define two different Capture event handlers - one that sets the value of a selectedItem global variable and another that navigates the user to the itemDetailScreen.
You can actually see a good example of such event handlers in the mobile template app, except that they're defined on the Press event.