Brian Dunning's FileMaker Custom Functions

While ( condition ; function ; limit )

Allows to use a while in FileMaker

  Average rating: 3.5 (89 votes) Log in to vote

Hisc   Hisc - Show more from this author
noplace
http://nourl

Share on Facebook Share on Twitter

  Sample input:
Let([
$var = 0;
_ = while ( "$var<350000" ; "$var=$var+1"; "" )
];
$var
)
  Sample output:
350000

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

this functions allows using a while function in FileMaker.
A limit of iterations may be specified; else, the limit will be set as 10000.
The function checks for error in the syntax of the condition and of the function

 

Comments

Hisc   Hisc, noplace
Sep 7, 2015
I'm sorry: I created this function and it's rated 1.1. I'm unaware of the problems in it. Please, comment here what is wrong with it:
- is the syntax failing?
- is there already another custom function that does the same?
- is it too slow? Too limited?
- is it lacking in technical capabilities or technical definition?
 
unin   unin, Japan
Sep 7, 2015
I wondered that yesterday I saw 5.0 on 2 votes become 2.0 on 40 votes now, but I think get it why.
This function is difficult to use, since it become infinite loop very easily if the parameters not given correctly, then FM freezes while recursion reached at limit of 500,000 (about 50sec). Many of trier might think this as something "crasher".

I like this type of challenge, but calling another recursive function in recursion makes easily up limit to about 50,000^2, isn't it?

And although if the result is correct, freezing (not responding) about 50sec is not kind for user.
 
Hisc   Hisc, noplace
Sep 8, 2015
I made some changes. I believe it will now be more suited to the needs.
It checks for error in the condition and in the function;
It establishes a limit for iteractions;

thanks for the help, Unin
 
Hisc   Hisc, noplace
Sep 8, 2015
Please, consider that the current rating – 2.1 stars – doesn't reflect in the actual code, which was heavily rewritten in 09/08/2015.
 

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: