GetNewCopyName ( name ; currentList )
Returns a new name for use in record duplication
Average rating: 5.0 (1 vote) Log in to vote
Stephan Casas - Show more from this author
http://www.stephancasas.com |
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
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.