Showing results for 
Search instead for 
Did you mean: 

How to reset a Barcode Reader control

A common Barcode Reader related question on the Power Apps Community forum is how to reset the scanned codes when the data is no longer needed (e.g. after patching).




In this blog post we’ll explore how introducing a collection to our scanning approach can easily allow us to build our own ‘reset’ functionality.





When trying to reset the ‘barcodes’ property of the Barcode Reader control, it may be tempting to opt for the reset function or search for the reset property.


The Barcode Reader, however, is a non-resettable control. In other words, we are unable to find the Reset property within the property list nor leverage the Power Fx Reset function. The latter results in the error ‘The function expects a resettable control as its input’.







Although the error above may look scary at first, the solution is quite simple. Instead of trying to reset the values within the ‘barcodes’ property, we can save the scanned values in memory via a collection and clear that collection when needed.


The solution involves 3 main steps:


  1. Collect the scanned values
  2. Display the data via the collection
  3. ‘Reset’ the barcodes by clearing the collection


Note: You can also opt for a variable to store the data instead of a collection – especially when only expecting 1 scanned value and not using the scan mode ‘Scan multiple’. Clearing the variable can be done by setting the value to Blank().



Save scanned values


Within the Barcode Reader OnScan property write the following code to save the barcodes output to a collection called ‘colBarcodes’:


//Save barcode(s) to a collection



Display scanned values


In order to display the scanned values, you will have to reference the collection instead of the ‘barcodes’ property.


//Gallery Items property



Reset barcodes


To mimic the reset functionality, clear the collection – and thus removing the scanned barcode values.


//E.g. Save or Clear button's OnSelect property


If you liked this blog post, feel free to give it a like👍 | For more tips and tricks check out my blog (LaurensM)📘