Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5992 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a Create New Record script that when it runs the first step it takes is it uses the 'Set Next Serial Value' script step using the Max Calculation:

Max (MATERIALREQUESTFORMS::MatlReq_Form# ) + 1

Then in a subsequent step it then uses the 'New Record/Request' script step to create the new record.

The problem I have is while I originally defined the field to use leading zeros in the serial number (by setting next value to 0006 for example) when the script runs it strips away the zeros and the next value I get is 7.

I there a way to add leading zeros via a calculation or is there some other way to do this?

Posted

Max() is a numerical operation - it returns a number. See also:

http://fmforums.com/forum/showtopic.php?tid/193363/

You could use SerialIncrement() on the result to restore the leading zeros. But a better solution would be to use an auto-entered serial ID. Otherwise you can get duplicate IDs when two users create a record at the same time.

Posted

Thanks comment. I knew there was something that would work and while I swear I just read through my whole list of functions I just didn't see 'SerialIncrement()' (or I was just too impatient tonight to read through them carefully and attentively).

Regarding:

But a better solution would be to use an auto-entered serial ID. Otherwise you can get duplicate IDs when two users create a record at the same time.

That's not really a problem in this particular case since the chance of two simultaneous users creating a 'Materials Request Form' document at the same time are thousands to one and even if it did happen they would probably be for different Job Number and Job Name so that would be okay too.

And the KeyID for each 'Materials Request Form' is a Unique Key using a technique that accounts for simultaneous creation and I think I probably picked it up here years ago.

Posted

I know of NO method that can ensure unique IDs, other than Filemaker's built-in auto-entered serial number. That's not to say that such a method does not exist, only that I haven't seen one so far. Thousands to one are pretty good odds when you have thousands of records.

This topic is 5992 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.