Brian Dunning's FileMaker Custom Functions

GetNewCopyName ( name ; currentList )

Returns a new name for use in record duplication

  Average rating: 5.0 (1 vote) Log in to vote

Stephan Casas   Stephan Casas - Show more from this author
http://www.stephancasas.com

Share on Facebook Share on Twitter

  Sample input:
GetNewCopyName ( "my_file" ; "my_file¶my_file copy¶random_file¶my_file copy 2¶other_file" )
  Sample output:
"my_file copy 3"

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

This function is useful when duplicating records. It will return the supplied name with "copy" or "copy X" (where 'X' is the next sequential copy number). This behavior is similar to the file system on a Mac or a PC, when duplicating a file in-place.

To use the function, supply the name you wish to use as text and the current list of names for which the returned data will be a member. For example, if duplicating an item in a table of files, you may have the following list of file names:

"my_file copy¶random_file¶my_file copy 2¶other_file"

Passing "my_file" into the function along with this list will return "my_ file copy 3" because the values "my_file copy" and "my_file copy 2" already exist. The function does not return "my_file" because copies of that root name already exist.

If you were to supply a name and an empty value list, the function would return the name. Similarly, if you were to supply a name and a value list that did not contain either the name or copies of the name, the function would return the name.

You can use a cartesian join with the List() function to supply your currentList parameter when manipulating data in tables.

 

Comments

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: