Hi all. Is it possible for force a number field to accept a set number of digits. For example, any number entered in the field must be 15 digits long? Thanks.
Is this in the context of a Form?
If so, you can configure the Number entry component to accept max & min values.
Ohhh, I assumed that was a value amount… as in the number must be between 0 and 100. Not the number of digits! LOL! How embarrassing!
The Min and Max Value are about the number, not the number of digits. I just tried by setting both as 15 (as the number must be 15 digits in length) and the field would then only accept 15 as the only entry. So that isn’t what I’m after. I need the number to be 15 digits in length if that is possible
Well, it is a value amount. But you can still use it to enforce the number of digits. Taking your example (15 digits), you would use:
- Min:
100000000000000
- Max:
999999999999999
Oh. Right. Well, I would never have guessed that! LOL. Can I please ask another question relating to this field? How would I set this field to ensure it is unique? Each microchip number is unique so it would be great (but not a deal breaker) if we could enforce that each number is unique.
So far I’m loving Glide! It truly is no-code and fairly easy to work things out… few curly things that aren’t obvious (well, for me) but the help in this forum has be fantastic!
So when somebody submits a record, you need to ensure the number being submitted doesn’t create a duplicate record, yes?
For this you would need to use a Custom Form, which is a semi-advanced technique. Take a look at the below:
Not a duplicate record because wouldn’t that assume that the microchip is a key field? Basically, I just want to ensure that the microchip isn’t used in two or more rows (so therefore two or more cats) because a microchip is unique to the cat. Does that make sense? If not possible, no worries, I was just curious since I was fixing that field. Same with the Cat Name field. That needs to be unique, too. We never name our cats the same name so in this instance I want to ensure no double record made.
Yeah, when I said duplicate that’s really what I meant. Glide doesn’t really have a concept of primary keys in the same sense that a traditional relational database does.
But anyway, using a custom form is the way to go. If you make a copy of the template App in the post that I linked to, you can study the way that it prevents a duplicate name. You would need to use a similar technique.
Hmm yep this is proving to be beyond me. I’ve copied your form to my dash but I’m not really understanding how you’ve set it up. Is it possible to a) make a copy of my stuff so when I’m playing I don’t kill what I’ve already done and then b) copy your stuff into my stuff? I can’t work out what I assume is nesting as yours shows things like form/enableWarning but I can’t work out where the form part came from. I want to work this out but I don’t want to kill what I’ve done so far either LOL which I suspect I will.
EDIT: Worked out how to copy an app and data so I’ve made a backup while I play around.
You can duplicate your app and play with it as a sandbox environment, or you can turn off auto publishing and be able to revert if something goes wrong.
You have to do it yourself since there’s no native integration for it.
That’s called Column Grouping.
Hazzah! I worked it out. Not 100% sure on what it is doing yet but seems to be working. Just need to work out how to get all the extra fields I need into the new Add and Edit screens but that should be ok to do.
It does raise another question in my head about version control and updates, but I’ll ask that in a separate question so I stop hijacking this thread. Thank you again for all your help!