Validation Pattern Matching – the Scan Mask

What options are available for Pattern Validation?

When creating a ‘Validate Scans with a Database’ type Service your have two options:
  1. You can check the ‘Apply a Validation Pattern’ box. The instructions are noted below. The benefits of this option include a) the ability to easily add scanned values to the database if they are not already there; b) forcing an invalid response if there’s a match, for example to indicate if an item is discontinued.
  2. You can create a standard validation service (i.e. don’t check the ‘Apply a Validation Pattern’ box) but when creating your service use the powerful Alter Scan Value feature.

What can I do with Validation Patterns?

You can catch invalid or duplicate IDs without a complete database residing on our servers – or even without a database at all.

Use-cases include:

  1. Tickets can now be sold immediately prior to an event without needing to upload their ticket IDs to codeREADr. In fact, no ticket IDs need to be uploaded at all to catch duplicates.
  2. Service providers don’t have to upload databases to our servers – whether for privacy concerns (e.g. student or patient IDs) or because the database is too large (e.g. coupon IDs).

Once scanned, the actual scanned ID is stored either online or on the device to enable checking for duplicates and to provide reporting.

What is Validation Pattern Matching? 

Validation Pattern matching is an advanced concept in which a user can specify how the app reacts to scans that match a “pattern”. The format of a pattern relies on three things:

  • Length: Barcodes must have the length of the pattern to match.
  • Required Characters: Barcodes must match positions in which there are letters, numbers, or symbols in the pattern.
  • Wildcards: Barcodes can have any character in the position where the symbol ? is placed.

Example
If the pattern entered is F767-??????, any barcode that starts with the characters ‘F767-‘ and ends with any six characters will be returned as valid. 

Here are some entries that would and would not match the pattern F767-??????:

F767-abc123matches
F767-ABC!@#matches
F 67 7-abc123does not match: the 7 and 6 are in the wrong position.
F767-abc123 4does not match: too many characters
f 767-abc123does not match: one of the required characters is in the incorrect case

 

Validation_Pattern_normal

How to Setup a Validation Pattern Matching Service:

1Create a validation service, or edit one of your existing services.
2Cick “Apply a Validation Pattern” and a new section will appear.
3Using normal characters and the ? symbol, define a pattern. ( See Examples Above )
4Enter a response to show the app user when the pattern is matched.
5[OPTIONAL] Checking the box ‘Add scanned value and response to the database when a match is made’ will add the scanned barcode, the pattern’s response, and its validity to the service’s database. IMPORTANT: If you want to check for Duplicate scans you need to check this box.
6Press ‘Save and Continue’ to save your changes and continue creating/updating your service.

Combining Scan Mask with Databases.

You can use Scan Mask with or without a validation database. If you upload a database to our servers, this service type will first check that database to see if the barcode value is in the database. If it is, then it validates against that database. If it isn’t, then it validates against the pattern.

No Pattern? No Problem.

If your IDs don’t have a known pattern other than the number of characters in the ID, then you can use the ? wildcard for every position to save the barcode value to the associated database. If you don’t have a known pattern and not all barcode values are the same length, then leave the Code Pattern field empty and anything you scan will be added to the database.

Why would you use Scan Mask’s pattern validation without a pattern or even without an original validation database? Because it enables you to add barcode values to a database when you check the box ‘Add scanned value and response to the database when a match is made.’ In this way you can catch duplicate scans for both online and on-device database services.

What would a typical set-up look like for validating with a partial database or no database at all?

Validate with Partial Database or No Database at All

 

Why ‘force’ an invalid response?

If you check the box ‘Force an invalid response when a scan match is made’ you can alert the app user when certain barcode values need special attention. For example, you could alert them when they scan expired expired tickets or discontinued items.

Need a more sophisticated validation pattern?  Use regex!

You can use the Alter Scan Value option with regex or you can do that here, too. Simply check the box ‘Use Regular Expression’ and enter your script in the form field.

Example A – Allow any number of alpha or numeric characters after the prefix ‘xxx’ to be valid.

^({xxx}{?})$

Example B – Allow only 4 or 5 digits after a prefix ‘xxx’ to be valid.

^xxx(([0-9]{4})|([0-9]{5}))$

Need help writing your regex? Contact support.

Does the pattern validation service type work with the Alter Scan Value and Alter Scan Response features?

Yes, it does.

in Services