Software Venture Consulting

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

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


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:  

RatingRatingRatingRatingRating
  Average rating: 4.3  (35 votes)
  Discuss this Custom Function

Martti Tumanto, Martinova Oy
http://www,martinova.fi

Adds a constant string to very Nth position of a string

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


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

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

Recursive CF that formulates output strings by adding a constant string to every Nth position resulting a more readable grouped output for longer strings ( f.eg 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 BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

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

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.

Thanks.

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

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:
City/Location:
Comment:
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 6 + 3 =
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. ProperAllWords ( text )
  (Thu, Dec 14, 5:19pm)
2. MatchExist ( SourceTable.Field ; DestTable.Field ; ReturnField )
  (Thu, Dec 14, 1:07pm)
3. BVR_Format ( bvr )
  (Wed, Dec 13, 5:32pm)
4. NumberToHexadecimal(NumberValue)
  (Fri, Dec 08, 8:54am)
5. Get_BaseTable
  (Thu, Dec 07, 4:27pm)
6. JSONCreateVarsFromKeys ( json ; namespace )
  (Wed, Dec 06, 8:21pm)
7. GetTableNzme ( field )
  (Tue, Dec 05, 9:16pm)
8. TimeFormatAsText ( theTime )
  (Mon, Nov 13, 1:59pm)

RSS Feed of Custom Functions