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

ALoopingDemo ( AnyText )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.8  (24 votes)
  Discuss this Custom Function

Doug Staubach, FileMaker Poweruser
https://www.linkedin.com/in/dougstaubach

This demo shows how to create a conditional loop within a custom function (similar to Do-Loop; Do-While and For-Next).

Sample Input:
ALoopingDemo("Test")
Sample Output:
Test.1.2.3.4.5.6.7.8.9.10


 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:

WHY THIS TECHNIQUE IS NEEDED:

1. FileMaker custom functions do not support looping statements (Do, While, For-Next) or line-jumping (GoTo).

2. FileMaker custom functions do not support the use of "optional parameters" (parameters that do not have to be included with the function call), which might help to simulate some of the above functions.

The code demonstrated in this function shows how to create a conditional loop using Case(), Let(), Recursion, and a local script variable ("$", not "$$").

Using this technique, you can create a loop with the ability to perform different actions at each "step" in the loop (1, 2, 3, etc.).

DEPENDENCIES:

1. Tested using FileMaker 13 - should work on v12 also.

2. Does not have any dependencies on any other custom functions.

3. Does not require a secondary function to keep track of counters.

NOTES:

1. I did not invent this technique. It has been in existence for a long time (if you know the original author, please let me know so I can give them credit). I am just showing a simple example for people who want to include some sort of looping mechanism inside of a FileMaker custom function, and haven't tried this method before.

2. FileMaker has a limit of 10,000 nested recursions per function call. Therefore, it makes sense to use this technique for an internal loop counter, but it is not good to use this technique for looping through large data sets (in that case, you might want to check out the looping capabilities of FileMaker scripts, which have fewer limits).

3. You will need a copy of "FileMaker Advanced" to *create* a custom function, but functions that have been created with "FileMaker Advanced" and saved into a database, can be freely used by "FileMaker Pro" clients who access that database.

If you like this function, please rate it (scroll up, under the function name), or leave a comment below.

Doug Staubach

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:

5 most recent comments | Show all 6 comments

Very well explained and exposed. congrats!

Brian, Mexico
March 25, 2015 11:06am

Boy, i use and studied many CF but this is one CF i cannot see ANYTHING from its example! Why and how got numbers 1-9?? sounds really neat though!!

jLT StructuresFromSilence, Kendv,IN USA
March 27, 2015 3:38pm

Hi all:

Unix - yes, you can start the loop midway if you set the $LoopCount to 5 before you call the function.

Brian - thank you very much, glad you found it useful!

jLT - The numbers 1-9 come from the middle loop (AnyText = AnyText & "." & $LoopCount)

Best wishes,
Doug

Doug Staubach, Denver, Colorado, USA
March 27, 2015 10:45pm

Extremely useful function! Thank you very much for taking the time to explain.

This is a template function that should deserve a special place in the function list, because it is really the starting point for many other CF's.

Hans Erik Hazelhorst, Utrecht, Netherlands
June 27, 2015 3:02pm

Hi Hans:

Thank you; I'm glad that you found it so useful!

Doug Staubach, Denver, CO USA
November 12, 2015 1:49pm

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 3 + 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