Ignore alpha input

I use a fast user switching setup posted by RickH ages ago, with RFID tags. Part of the function involves using the NumberpadValue.

Scanning an RFID tag it matches to a User PIN and logs on the correct user, logging the current one off.

However, on our latest location we have inherited some tills that use 13.56MHz RFID readers, which typically have an alphanumeric RFID code.

This isn’t a problem when logging on initially as an RFID tag of, say, EA425F60 will read as 42560, and log in the user with that PIN.

However when already logged in, the NumberpadValue is set as the full string, so it appears not to be a valid user ID. Is there any way to have any alpha characters disregarded on number pad entry?

Hope this makes sense, if not, I will try to clarify!

If what you enter on the number pad does not match a product barcode, then you can capture the input using a rule with Numberpad Value Entered event. You can then strip off any non-numerical digits using a RegEx function, then pass that resulting number to another rule to handle the fast user switching.

For the function, this should do the trick:

'[:NumberpadValue]'.replace(/^\d+$/g, '')
2 Likes

Cool thanks!

Forgive me perhaps being slightly dim but where do I need to enter the function? Screenshots of the two relevant rules attached
Screenshot 2021-07-20 at 17.14.06

Wherever you are using [:NumberpadValue] to get the value entered, replace it with

[='[:NumberpadValue]'.replace(/^\d+$/g, '')]

I think that would get rid of the numerical digits. I think this one would work instead.
[='[:NumberpadValue]'.replace(/\D+/gi,'')]

Edit: if the above one doesn’t work, try this after:
[=TN('[:NumberpadValue]'.replace(/\D+/gi,''))]

2 Likes

Thanks both - I am not back on site for a couple of days now but will try the above and confirm which works!!

Cheers

1 Like