Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

AddConstantToString( string; fillchar; posit ; direction; iter)

Rate this function:  

  Average rating: 4.4  (35 votes)
  Discuss this Custom Function

Martti Tumanto, Martinova Oy

Adds a constant string to very Nth position of a string

Sample Input:
AddConstantToString (123456789 ; "-" ; 5; "Right";0 )
Sample Output:

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.


Recursive CF that formulates output strings by adding a constant string to every Nth position resulting a more readable grouped output for longer strings ( Bank references, serial numbers etc).
Grouping starts either Right (default) : 12-345-678 or Left: 123-456-78

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

This is my Custom Function and I want to edit it


You have an error in the CF. You have changed the name of your CF where it calls itself.

Solution is to change the name of the CF,

Or better yet, change the Calculation where it calls itself. i.e.
change AddFillCharToString to AddConstantToString


Lee Smith, Woodland
September 08, 2009 11:42am

Corrected, thank you Lee

Martti Tumanto, Espoo, Finland
September 09, 2009 6:54am

I'm new to custom functions so I'm trying to learn the logic behind specific lines in this.

1. The "char" variable is set to the Mod function, but what does the <> 0 do? I cannot find where that would be supported as it's outside the Mod function.

2. The "stringout" function uses the Case function. The first test checks for iter=1, and sets the result to blank if true. There are no other tests within this Case startement however, but there are 3 more segments after this. I assume these to be default values, but that would mean three default values. How can you have more than one default in a single Case statement?
stringout = Case
iter = 1 ; "" ; //test and result if true
char ; //no test so default 1
dir1 ; //no test so default 2
fillCharacter //no test so default 3

The function works, I just don't know how it does with these variables defined that way.


Mike, Tennessee USA
October 22, 2015 5:00pm

Hi Mike!

Thank you for your comment. Nice to hear that CF works. Here is some explanation about the magic:
1. char = Mod (iter ; posit+1) ≠ 0 . This is a Logical statement, equivalent to
char = if ( Mod(item ; posit+1 = 0 ; 1 ; 0)

2. Stringout-function ; please check the syntax of Case function: in this case
case (item = 1 ; "" ; // OK? write nothing in 1st iteration, just initiate recursive variables
char ; dir1 //if char flag is on , write the char (the names of these variables are admittedly misleading)
fillChacracter // this is the default ; write the fillchar

Happy learning with Filemaker!


Martti, Espoo, Finland
October 22, 2015 9:46pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 7 + 2 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions