Power Apps: Data Validation Approach for Canvas Apps Barcode Scanner [Part 2]

Hey there,

In the previous part, we have seen a data validation approach for Canvas App scanner while we were dealing with small data volume. In this part, we’ll see a validation approach that we should take when we are dealing with large data volume.

Scenario: You are validating that the scanned product Id is a valid product Id in your Fin & Ops application. Because, in Fin & Ops we can expect large number of products. So this sort of validation required some extra care to maintain accuracy.

So let’s see that approach with example.

My Canvas App

We are using the same Canvas App that we have used in Part 1 of this series. We have added another scan screen for Product and we’ll perform a validation for a scanned product Id.

“Scanned Product ID” will show a product Id that you’ll scan from a barcode.
“Valid Product” will show “Yes”, if the scanned Product is a valid Product, it will show “No” for invalid Product.

Validation Approach:

To avoid validation inconsistencies while dealing with large data, we should first load the data in a collection and then we should use that collection for validation.

1) On “OnStart” Action of your App, write the following expression.
Clear(<Collection name>);Collect(<Collection name>,<Datasource name>);

2) On “Text” property of “Valid Product” value box, write the following expression.
If(IsBlank(LookUp(<Collection name>, <‘Column name’> = <‘Scanner Control Name’>.Text )), “No”, “Yes” )

That’s it! Though, “OnStart” action will take few seconds to load the data in your collection. But this approach will be accurate and validation will be super fast.

In this series we have learned some simple techniques to accurately validate the data that we are scanning from a Canvas App scanner. We’ll see more Canvas Apps techniques and approaches in our upcoming blogs. So stay tuned !

Thank you!

Reference:

  1. https://abkblogs.home.blog/2021/01/30/power-apps-data-validation-canvas-apps-scanner-part-1/
  2. https://barcode.tec-it.com/en/QRCode?data=D00112

One thought on “Power Apps: Data Validation Approach for Canvas Apps Barcode Scanner [Part 2]

Leave a comment