Hi this is Matt Navarre with AppWorks and today I’m going to do a demo that shows 3 specific things: one of them is field validation and settings that make good sense to use, and the difference between using a serial number and a UUID, and how that connects to field validation.

I’m using the demo file that comes with fmSearchResults – I’m logged in with 2 different copies of FileMaker – once as a full-access user and once as a regular, lower-level access user. Here’s my field validation and my settings right now – so in my ID field for this table, it’s just a serial number, and my validation is requiring that its unique, which is actually a default setting in FileMaker, not for serial number but it does have that unique checkbox checked.

So if you make an error as a developer, here’s how it will affect your user. If I go as a user and make a new record in this table and I just click out of it, I immediately get an error that says ID is defined to contain unique values – you have to enter a unique value, and my choices don’t really make any sense. Ok, a reverse, so I click Ok and think everything is good. I start typing new things, and then I try to commit my record by clicking onto the gray. I get another error saying This ID is not unique. I can click OK, I can try to change it and I can’t change it and it’s not an editable field. My only other option is to revert the record, which deletes the entire record and I see this error saying I’m going to lose everything. Not a good situation for a user, so how do I get around it?

Rather than using serial numbers, one thing I would recommend is using UUIDs, so use calculative value and there’s a simple function called GetUUID. There’s another one called GetUUIDNumber, but I would recommend against that one. So now I’m going to switch over to my validation tab and not require this to be unique. UUIDs are pretty much going to be unique – there are only crazy circumstances when it wouldn’t be.

Now if I go over to the other account and just create a record, I get this really long number that’s unique. That’s basically our recommendation for primary keys and a warning against some of the dangers of field validation features in FileMaker and why all of the things on the validation tab should be used very sparingly and very carefully. Thanks for your time!