Brian Dunning's FileMaker Custom Functions

NextID ( valueList ; start )

Returns the lowest NOT used number of a value list.

  Average rating: 3.9 (42 votes) Log in to vote

Daniele Raybaudi   Daniele Raybaudi - Show more from this author
ACI
http://www.aci.it

Share on Facebook Share on Twitter

  Sample input:
NextID ( 1¶2¶3¶4 ; 1 )
NextID ( 4¶6¶8¶9 ; 1 )
NextID ( "" ; 1 )
  Sample output:
5
1
1

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

NextID ( valueList ; start ) custom function

Author: Daniele Raybaudi

Parameter:
valueList - list of numbers
start - number from wich to start the progression

Returns the lowest NOT used number of a value list.
So:
NextID ( 1¶2¶3¶4 ; 1 ) returns: 5
NextID ( 4¶6¶8¶9 ; 1 ) returns: 1
NextID ( "" ; 1 ) returns: 1

I used this CF to automatically recover the progression of an auto-entered number, when a record is deleted.
Simply make:
1) a value list ( "IDs" ) with values coming from the field
2) enter this calc into the option for auto-enter a value in the field:
NextID ( ValueListItems ( Get ( FileName ) ; "IDs" ) ; 1 )

BTW: try the free demo file at:
http://fmforums.com/forum/showpost.php?post/233683/

 

Comments

Heidi   Heidi, Mechanicsburg PA
Feb 12, 2010
THANK YOU! This is EXACTLY what I was looking for!
 
Simon Plint   Simon Plint, Newcastle/Australia
Mar 21, 2010
Ditto
 
lloop   lloop, Vienna, Austria
Nov 25, 2010
Ditto (Ditto + 1)
 
matrix2012   matrix2012, italy
Mar 19, 2012
La funzione e bellissima, purtroppo, se "duplico" un record, il nr. progressivo non si aggiorna, lo stesso errore, si evidenzia se importi dati da un'altro file.
Mi farebbe piacere sapere se è possibile un intervento di rettifica in modo da farla funzionare anche con i due errori suddetti.
 

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: