Brian Dunning's FileMaker Custom Functions

GetNextMaxSerial

Gets the next serial number without the need of context

  Average rating: 4.2 (29 votes) Log in to vote

Ibrahim Bittar Torres   Ibrahim Bittar Torres - Show more from this author
Eikonsys, S.A. de C.V.
http://www.eikonsys.com

Share on Facebook Share on Twitter

  Sample input:
GetNextSerial ( TheTable , TheField )
  Sample output:
GetNextSerial ( "Activities" , "ActivityID" ) = 15

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Sometimes during development we modify serial values in fields and the actual values can be higher than the next serial value set on the field.

This function returns the next serial value AFTER the maximum value in the table.

For example, suppose you have a field called MyID, which has a next value of 530, but in your table there is a record with a value of 600. Well, this function will return 601 because the next value after the maximum is 601.

This is useful when you import data and need to set the next serial value after the maximum value found in the table.

 

Comments

Hisc   Hisc, noplace
Feb 2, 2015
Shouldn't it be name GetPossibleSerial? Because it doesn't necessarily retrieves the NextSerial, but one next possible serial...
It can cost time of debugging. Imagine someone who, in the main table, has a global field with GetNextSerialValue and, in a related function, wants to use your CF, GetNextSerial, each to set one variable.

To be honest, I'm having trouble figuring when this would be better than GetNextSerialValue
 
unix   unix, Japan
Feb 9, 2015
Both functions can't be used in unique field.
 
Ibrahim Bittar   Ibrahim Bittar, León, México
Feb 10, 2015
Thank you Hisc and Unix for your comments.

I changed the function name and added a longer description so it can be easier to understand.

Please let me know what you think.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: