Brian Dunning's FileMaker Custom Functions

GetRootCopyName ( name )

Returns the root of a name which has had "copy" or "copy X" added to it

  Be the first to rate this function 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:
GetRootCopyName ( "my_file copy 7" )
  Sample output:
"my_file"

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

This function is useful when examining duplicated records. It will return the root of a supplied name that has had the term "copy" or "copy X" (where 'X' is a sequential copy number).

To use the function, supply the name for which you wish to extract the root. For example, you may have the following example names:

"my_file" or "my_file copy" or "my_file copy 14"

Passing any of these text values to the function will return "my_file" because it is the root name in each case.

The function can even handle names which use the term "copy" as part of the name itself, such as "my copy file copy 3." In such a case, the function will return "my copy file" and not "my" on its own. This is possible because the function examines the tail of the supplied name, rather than the whole name.

You can use this function with GetNewCopyName ( name ; currentList ) (available on briandunning.com) to create an effective nomenclature when duplicating records.

 

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: