Only accept starting with 8 no dashes or dots or spaces

1st I have to thx u all of community. today my app shows in the biggest Tv cia of latam TV Globo and people is using the app that a developed with help of this community. I’m too happy!

Now I need to fix sth.
The main input is a text like a hash with 44 or 48 numbers that it´s a id of bills.

The type of bills that my project helps,the code has to begin with 8 and people cant insert dot, dashes or spaces. how can I assure that? Otherwise the user cant insert the record/row.

Today I accept and fix in the Google but I’m receiving many things, texts, msgs…code with dots, spaces …so forth.

Pls help me!

2 Likes

Just trying to understand…

  • Your users manually enter this code?
  • or, your app needs to generate the code for them?
  • if the app is generating the code, does it need to be unique?
  • if your users are entering it, do you need to validate it against a known list of codes?
  • You say “no dashes, dots or spaces”. Are they the only invalid characters?
  • What about ~&$°£º™Q? Would that be valid? - it doesn’t contain any dashes, dots or spaces :wink:
  • Maybe better to try and define the set of acceptable characters, rather than the unacceptable ones?
1 Like

Darren I have to thk u first of all. u helped me a lot.
Let´s go!

  • Your users manually enter this code? they can enter or I’m testing code bar reader. our light bills for instance comes with code bar and this long code like hash. like this
    image
    suppose that it´s your bill I need the code 8363…to pay for u in my internet banking.

  • or, your app needs to generate the code for them? not generate. the code comes in the bill.

  • if the app is generating the code, does it need to be unique? no.

  • if your users are entering it, do you need to validate it against a known list of codes? although each digit has a rule, in the first moment I only need to check if begins with 8.

  • You say “no dashes, dots or spaces”. Are they the only invalid characters? although as u can see the code comes with special char, let´s say, when people will pay they will need to type each digit or past if the codes comes like hash 8363…all together.

  • What about ~&$°£º™Q ? Would that be valid? - it doesn’t contain any dashes, dots or spaces :wink: no, no only numbers!

  • Maybe better to try and define the set of acceptable characters, rather than the unacceptable ones? only numbers. all I need is to check if it begins with 8 and there are no dot, spaces any other one only numbers. got it?

you can scan this code in Glide, no need to manually enter
also when they enter manually … you can show warning if contain characters that you don’t allow or substitute them with “” empty

Thx Uzo! I discovered the scan code a few days ago. I’m intermediate let´s say…so I use to come here to learning. i.e. I don’t know how to show input text and only fill using scan code not enter manually. But I will test. Thx again.

open a column for scanned code, when user will scan the code it will go there.
add component text entry, assign it to that column … users can insert manually

Hi @Alexandre_Caruso

Just be aware there is a limit on the number of bar code scans on a pro subscription - 1000

I wouldn’t want you to develop your app with this feature if it is not going to provide you with the amount of scans your users may need. :+1:

Just saying :wink:

1 Like

thx Rose. The scan code is not a big issue for me. what I need is to enter only 44 ou 48 digits only. how can I do it?

I solved temporaly using template, replace spaces, dots, with nothing. but I still need to check/aprove to save only is the first digit of this code starts with “8” otherwise I cant accept to continue.

any tip?

If I’m understanding correctly, you want to check if the first digit is an ‘8’? To do that, I would first create a template column that joins ‘@’ to the code. Then create an IF column that checks if that template includes ‘@8’. If it does, then it’s true that the first digit is an ‘8’.

10 Likes

This is genius.

1 Like

Holy moly

2 Likes

It´s truth! Genius!
image

2 Likes

this kind of solutions were only available tools back in 80’s when using assembler and pure machine codes… this is how i grow up :wink:

3 Likes

what about counting the number of digits? I´d like to validate if this hash ( I call lovely) the code of bill is entered has 48 digits. any tip? thx

To validate the number length (always =48), you need to use a text column first (Glide will check it and notify an error message if length isn’t 48).
Later and internally, you can convert that text input to a number.

Saludos Alex

1 Like

If it’s a number, you should be able to count the the number of digits after the fact with some math.

You can see an example below. The only difference is that since you already have numbers, there shouldn’t be a need to convert to all 1’s to make it work. I’m not sure though if such a large number would calculate properly, so no guarantee that it would work. This is of course if you need a count after the data has been input and saved to the table. If you need it in a form, then @gvalero’s idea is probably better.

2 Likes

Right.

The best option to do it is using a Form and let Glide validates if all data is complete.

1 Like

That’s amazing solution.

2 Likes