Does a scanned field override the field's validation?

We have the following validation in place on a scannable field. The user scanned a barcode into the field and it looks like a period was generated but the field allowed it to be saved.

Does a scan override the fieldโ€™s validation or is there a validation expression problem?

Solved Solved
0 12 231
  • UX
1 ACCEPTED SOLUTION

Just wanted to update the post with the implemented solution: I added the following to the validation expression:

NOT(CONTAINS([_THIS],".")),

AND(
LEN([_THIS])=10,
NUMBER([_THIS])>0,
NOT(CONTAINS([_THIS],".")),
NOT(IN([BIN Barcode],SELECT(Collection[BIN Barcode],
AND(NOT([collection_id]=[_THISROW].[collection_id]),
[route_id]=[_THISROW].[route_id]))))
)

View solution in original post

12 REPLIES 12

Im not following your point here.

Scan is scan, and validation is validation.

Get the value through scanning is same thing that that use manually type the text into the fields.

Once the text and strings are captured to the column, if they are savable, then there would be a problem in ValidIf expression and validtion for sure.

Thanks Tsuji, based on your notes (scanned number = entered number) Iโ€™m wondering how this BIN Barcode was saved in the database when it doesnโ€™t meet the valdif requirements.

Hi @Daisy_Ramirez

Hope you are well.

I just thought your validation is against NUMBER , which is naturally no decimals, but your actual data is not a number, but decimal, how do you clarify this point ?

Are they simply text ?

Thank you Tsuji - doing well Currently I have it set to TEXT but used the NUMBER() to indicate only a numerical value is allowed - characters are not allowed in the field. Its a barcode being scanne.

Hope youโ€™re all staying well

Thanks Daisy, I m super well, luckily.

Im not sure how your 3rd validation expression of NOT(IN([Binโ€ฆ) would work for your presented case, but 1st of 2 expression len() and number is meeting your result of
11.0000199

11.0000199 โ€” len is 10 (they are text, so inc. period)

Removing decimal part, is 11. Yes more than 0.

AppSheet - san is working based on your expression rightly.

I would agree if the โ€œ.โ€ is considered valid for NUMBER(). Is this the case? If yes, which validation expression should I use to ensure โ€œ.โ€ is not allowed.

Before you pass the string (texts) for validation through your expression, you need to remove .
using substitute expression.
This is what I thought now quickly, while i m enjoying my beer!!!

When you selet text, all the character is just one string inside your whole string.

Thanks Tsuji! Iโ€™ll try the substitute. Enjoy your beer - and have another for me!

Have a great weekend

Your source and original field and column for valiation is text type, which gives a trickiness.

Before you pass the value of tihs fields for your own validation, why do you the validate by getting though such a validation?

Count(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
[Text],โ€œ1โ€,""),
โ€œ2โ€,""),
โ€œ3โ€,""),
โ€œ4โ€,""),
โ€œ5โ€,""),
โ€œ6โ€,""),
โ€œ7โ€,""),
โ€œ8โ€,""),
โ€œ9โ€,""),
โ€œ0โ€,""),
โ€œ.โ€,"")
)=0

This should make sure the data being scanned by your users are always number (incl period) , otherwise can not pass to your next validation.
When text is included, then it fails this validation.
Just have a think.

Thanks Tsuji!

Just wanted to update the post with the implemented solution: I added the following to the validation expression:

NOT(CONTAINS([_THIS],".")),

AND(
LEN([_THIS])=10,
NUMBER([_THIS])>0,
NOT(CONTAINS([_THIS],".")),
NOT(IN([BIN Barcode],SELECT(Collection[BIN Barcode],
AND(NOT([collection_id]=[_THISROW].[collection_id]),
[route_id]=[_THISROW].[route_id]))))
)

Top Labels in this Space